public void Visit(NotNode node) { if (node.Children.Count != 1) { throw new InternalCompilerError("Invalid child count for not-node"); } node.Children[0].Accept(this); if (node.Children[0].NodeType() != VariableType.BOOLEAN) { reporter.ReportError( Error.SEMANTIC_ERROR, "Incompatible expression for operator '!'", node.Line, node.Column); reporter.ReportError( Error.NOTE, "Expression has type '" + node.Children[0].NodeType().Name() + "'", node.Children[0].Line, node.Children[0].Column); reporter.ReportError( Error.NOTE, "Operator '!' expects the expression to have type '" + VariableType.BOOLEAN.Name() + "'", node.Line, node.Column); node.SetType(VariableType.ERROR_TYPE); } else { node.SetType(VariableType.BOOLEAN); } }
public void Visit(NotNode node) { node.Children[0].Accept(this); Emit(Bytecode.NOT); }