/**
         * 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);
        }
Beispiel #2
0
 // Declarations
 public int VisitBinaryOperatorDeclaration(BinaryOperatorDeclaration ast, Frame frame)
 {
     return(0);
 }
 public Void VisitBinaryOperatorDeclaration(BinaryOperatorDeclaration ast, Void arg)
 {
     return(null);
 }
 void EnterStdDeclaration(BinaryOperatorDeclaration declaration)
 {
     EnterStdDeclaration(declaration.Operator, declaration);
 }