Skip to content
Snippets Groups Projects
Select Git revision
  • b25d312c0f06de310ae8420ae6a0e84330724255
  • master default
  • labcomm2014_tc31
  • labcomm2014
  • js
  • java_dyn_msg_dec
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.1
  • v2014.0
  • v2013.0
14 results

ErrorCheck.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    Source project has a limited visibility.
    ErrorCheck.jrag 656 B
    import java.util.Collection;
    
    aspect ErrorCheck {
    
    	syn int ASTNode.lineNumber() = getLine(getStart());
    
    	protected String ASTNode.errors = null;
    	
    	protected void ASTNode.error(String s) {
    	    s = "Error at " + lineNumber() + ": " + s;
    	    if(errors == null) {
    	      errors = s;
    	    } else {
    	      errors = errors + "\n" + s;
    	    }
    	}
    
    	protected boolean ASTNode.hasErrors() {
    		return errors != null;
    	}
    	public void ASTNode.errorCheck(Collection collection) {
    	    nameCheck();
                typeCheck();
    	    if(hasErrors())
    		collection.add(errors);
    	    for(int i = 0; i < getNumChild(); i++) {
    		getChild(i).errorCheck(collection);
    	    }
    	}
    
    }