public override object VisitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
        {
            Expression invokerExp  = (Expression)Visit(context.expresion()[0]);
            Type       invokedType = null;

            if (context.TYPE() != null)
            {
                string s = context.TYPE().GetText();
                if (p.Types.ContainsKey(s))
                {
                    invokedType = p.Types[context.TYPE().GetText()];
                }
                else
                {
                    invokedType = new Type(context.TYPE().GetText(), null, GetCoord(context));
                }
            }

            List <Expression> parameters = new List <Expression>();

            for (int i = 1; i < context.expresion().Length; i++)
            {
                parameters.Add((Expression)Visit(context.expresion()[i]));
            }

            var d = new Dispatch(invokerExp, invokedType, context.ID().GetText(), parameters, GetCoord(context));

            return(d);
        }
예제 #2
0
 public AtsimNode(CoolParser.AtsimExpContext context, Node s) : base(s.Childs)
 {
     this.context = context;
     Expresion    = context.expresion(0);
     Params       = context.expresion();
     MethodID     = context.ID();
     try {
         CallerType  = SymbolTable.Classes[context.TYPE().GetText()];
         Method_Node = SymbolTable.Classes[CallerType.Name].Methods[context.ID().GetText()];
     }catch (Exception) { /* :( */ }
 }
예제 #3
0
파일: TypeVisitor.cs 프로젝트: maxblu/coolc
        public override Node VisitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
        {
            var s = VisitChildren(context);

            return(new AtsimNode(context, s));
        }
예제 #4
0
 public override object VisitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
 {
     VisitExpr(context);
     return(VisitChildren(context));
 }
예제 #5
0
 /// <summary>
 /// Exit a parse tree produced by the <c>atsimExp</c>
 /// labeled alternative in <see cref="CoolParser.expresion"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by the <c>atsimExp</c>
 /// labeled alternative in <see cref="CoolParser.expresion"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
 {
     return(VisitChildren(context));
 }
예제 #7
0
 public override bool VisitAtsimExp([NotNull] CoolParser.AtsimExpContext context)
 {
     return(VisitChildren(context));
 }