示例#1
0
 public override void Visit(PrintStatement node)
 {
     // Argument must be an integer.
     var type = node.Argument.Type;
     if (type is ErrorType) return; // Type errors are never checked in recovery.
     if (type.Name != MiniJavaInfo.IntType)
     {
         ReportError(
             ErrorTypes.TypeError,
             String.Format("Cannot print expression of type {0}.", type.Name), node);
     }
 }
 public override void Visit(PrintStatement node)
 {
     HandleExpressionOrStatementNode(node);
 }