Ejemplo n.º 1
0
        /**
         * Creates a small AST to represent the declaration of a binary operator. This
         * declaration summarizes the operator's type information.
         *
         * @param op
         *          the spelling of the operator
         * @param arg1Type
         *          the type of the first argument of the binary operator
         * @param arg2Type
         *          the type of the second argument of the binary operator
         * @param resultType
         *          the type of the result
         * @return a BinaryOperatorDeclaration of the given operator with the given
         *         argument types and returning the given result type
         */
        static BinaryOperatorDeclaration DeclareStdBinaryOp(string op, TypeDenoter arg1Type,
                                                            TypeDenoter arg2Type, TypeDenoter resultType)
        {
            var opAst   = new Operator(op, SourcePosition.Empty);
            var binding = new BinaryOperatorDeclaration(opAst, arg1Type, arg2Type, resultType);

            return(binding);
        }
Ejemplo n.º 2
0
 // Declarations
 public int VisitBinaryOperatorDeclaration(BinaryOperatorDeclaration ast, Frame frame)
 {
     return(0);
 }
Ejemplo n.º 3
0
 public Void VisitBinaryOperatorDeclaration(BinaryOperatorDeclaration ast, Void arg)
 {
     return(null);
 }
Ejemplo n.º 4
0
 void EnterStdDeclaration(BinaryOperatorDeclaration declaration)
 {
     EnterStdDeclaration(declaration.Operator, declaration);
 }