Пример #1
0
        public FunctionDef(LatteParser.MethodDefContext context)
        {
            IsMethod = true;
            Type     = context.type();
            Id       = context.ID().GetText();
            Block    = new Block(context.block());

            var arg = context.arg();

            if (arg == null)
            {
                Args = new List <Arg>();
            }
            else
            {
                var idType = arg.ID().Zip(arg.type(), (id, type) => (id, type));
                Args = idType.Select(x => new Arg(x.type, x.id.GetText())).ToList();
            }
        }
Пример #2
0
 public override void EnterMethodDef(LatteParser.MethodDefContext context)
 {
     EnterFunctionDef(new FunctionDef(context), context.start.Line, context.block(), context.arg());
 }