public override ASTNode VisitFormal([NotNull] CoolParser.FormalContext context) { return(new FormalNode(context) { Id = new IdentifierNode(context, context.ID().GetText()), Type = new TypeNode(context.TYPE().Symbol.Line, context.TYPE().Symbol.Column, context.TYPE().GetText()) }); }
public override object VisitFormal([NotNull] CoolParser.FormalContext context) { Type outputType = new Type(context.TYPE().GetText(), null, null); if (p.Types.ContainsKey(context.TYPE().GetText())) { outputType = p.Types[context.TYPE().GetText()]; } return(new Tuple <string, Type>(context.ID().GetText(), outputType)); }
//public FormalNode(CoolParser.FormalContext context) //{ // this.context = context; //} public FormalNode(CoolParser.FormalContext context, Node s) : base(s.Childs) { this.s = s; this.context = context; this.ID = context.ID().GetText(); this.SetType(SymbolTable.Classes[context.TYPE().GetText()]); //this.Type = (ClassNode)s.Childs[0]; }