kiama.example.picojava

object ErrorCheck

[source: kiama/example/picojava/ErrorCheck.scala]

object ErrorCheck
extends AnyRef
This file is derived from a JastAdd implementation of PicoJava, created in the Department of Computer Science at Lund University. See the following web site for details: http://jastadd.cs.lth.se/examples/PicoJava/index.shtml
Value Summary
val collectErrors : (scala.collection.mutable.Buffer[java.lang.String]) => (Attributable) => Unit
Collect the errors for a node recursively. public void ASTNode.collectErrors(Collection c) { for(int i = 0; i < getNumChild(); i++) getChild(i).collectErrors(c); } public void AssignStmt.collectErrors(Collection c) { super.collectErrors(c); if(!getValue().type().isSubtypeOf(getVariable().type())) error(c, "Can not assign a variable of type " + getVariable().type().getName() + " to a value of type " + getValue().type().getName()); } public void ClassDecl.collectErrors(Collection c) { super.collectErrors(c); if(hasCycleOnSuperclassChain()) error(c, "Cyclic inheritance chain for class " + getName()); } public void WhileStmt.collectErrors(Collection c) { super.collectErrors(c); if(!getCondition().type().isSubtypeOf(booleanType())) error(c, "Condition must be a boolean expression"); if(!getCondition().isValue()) error(c, "Condition must be a value"); } public void IdUse.collectErrors(Collection c) { super.collectErrors(c); if(decl().isUnknown() && (!isQualified() || !qualifier().type().isUnknown())) error(c, "Unknown identifier " + getName()); }
val errors : (Program) => scala.Seq[java.lang.String]
All of the error messages for a program. public Collection Program.errors() { Collection c = new ArrayList(); collectErrors(c); return c; }
val isQualified : scala.PartialFunction[IdUse, Boolean]
Is this entity qualified? eq Program.getBlock().isQualified() = false; eq Program.getPredefinedType(int i).isQualified() = false; eq Dot.getIdUse().isQualified() = true; inh boolean IdUse.isQualified(); inh boolean TypeDecl.isQualified();
val qualifier : scala.PartialFunction[IdUse, Access]
What is the qualifier? eq Program.getBlock().qualifier() { throw new Error("Can not compute qualifier for non qualified names"); } eq Program.getPredefinedType(int i).qualifier() { throw new Error("Can not compute qualifier for non qualified names"); } eq Dot.getIdUse().qualifier() = getObjectReference(); inh Access IdUse.qualifier(); inh Access TypeDecl.qualifier();
val record : (scala.collection.mutable.Buffer[java.lang.String], java.lang.String) => (Attributable) => Unit
Record a new error in the collection. protected void ASTNode.error(Collection c, String s) { //c.add(getLine(getStart()) + ": " + s); c.add(s); }
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
val errors : (Program) => scala.Seq[java.lang.String]
All of the error messages for a program. public Collection Program.errors() { Collection c = new ArrayList(); collectErrors(c); return c; }

val collectErrors : (scala.collection.mutable.Buffer[java.lang.String]) => (Attributable) => Unit
Collect the errors for a node recursively. public void ASTNode.collectErrors(Collection c) { for(int i = 0; i < getNumChild(); i++) getChild(i).collectErrors(c); } public void AssignStmt.collectErrors(Collection c) { super.collectErrors(c); if(!getValue().type().isSubtypeOf(getVariable().type())) error(c, "Can not assign a variable of type " + getVariable().type().getName() + " to a value of type " + getValue().type().getName()); } public void ClassDecl.collectErrors(Collection c) { super.collectErrors(c); if(hasCycleOnSuperclassChain()) error(c, "Cyclic inheritance chain for class " + getName()); } public void WhileStmt.collectErrors(Collection c) { super.collectErrors(c); if(!getCondition().type().isSubtypeOf(booleanType())) error(c, "Condition must be a boolean expression"); if(!getCondition().isValue()) error(c, "Condition must be a value"); } public void IdUse.collectErrors(Collection c) { super.collectErrors(c); if(decl().isUnknown() && (!isQualified() || !qualifier().type().isUnknown())) error(c, "Unknown identifier " + getName()); }

val record : (scala.collection.mutable.Buffer[java.lang.String], java.lang.String) => (Attributable) => Unit
Record a new error in the collection. protected void ASTNode.error(Collection c, String s) { //c.add(getLine(getStart()) + ": " + s); c.add(s); }

val isQualified : scala.PartialFunction[IdUse, Boolean]
Is this entity qualified? eq Program.getBlock().isQualified() = false; eq Program.getPredefinedType(int i).isQualified() = false; eq Dot.getIdUse().isQualified() = true; inh boolean IdUse.isQualified(); inh boolean TypeDecl.isQualified();

val qualifier : scala.PartialFunction[IdUse, Access]
What is the qualifier? eq Program.getBlock().qualifier() { throw new Error("Can not compute qualifier for non qualified names"); } eq Program.getPredefinedType(int i).qualifier() { throw new Error("Can not compute qualifier for non qualified names"); } eq Dot.getIdUse().qualifier() = getObjectReference(); inh Access IdUse.qualifier(); inh Access TypeDecl.qualifier();