Exemple #1
0
        public override SemanticCheckResult VisitNegative(ASTNegativeNode Negatve)
        {
            var exp = Negatve.Expression.Accept(this);

            Negatve.SemanticCheckResult.Ensure(exp, exp.Type == CompilationUnit.TypeEnvironment.Int,
                                               new Lazy <Error>(() => new Error("Expresion must have type Int", ErrorKind.TypeError, Negatve.NegativeToken.Line, Negatve.NegativeToken.Column)));
            Negatve.SemanticCheckResult.EnsureReturnType(CompilationUnit.TypeEnvironment.Int);
            return(Negatve.SemanticCheckResult);
        }
Exemple #2
0
 public ASTCILNode VisitNegative(ASTNegativeNode Negative)
 {
     return(new ASTCILMultiplyTwoVariablesNode((ASTCILExpressionNode)Negative.Expression.Accept(this),
                                               new ASTCILIntConstantNode(-1)));
 }
 public virtual T VisitNegative(ASTNegativeNode Negative)
 {
     Negative.Expression.Accept(this);
     return(default(T));
 }