Skip to content
Snippets Groups Projects
Select Git revision
  • labcomm2014
  • labcomm2006
  • master default
  • python_sig_hash
  • typedefs
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.6
  • v2015.0
  • v2014.5
  • v2014.4
  • v2006.0
  • v2014.3
  • v2014.2
  • v2014.1
  • v2014.0
  • v2013.0
20 results

ErrorCheck.jrag

Blame
  • 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);
    	    }
    	}
    
    }