Пример #1
0
        public override void EnterMethodDefinition(FlyParser.MethodDefinitionContext context)
        {
            Code.MethodDefinition(context.name.Text,
                                  context._args.Select(x => x.Text).ToArray(), () =>
            {
                foreach (var statement in context.statement())
                {
                    EnterStatement(statement);
                }

                if (Code.Instructions.Last() != (int)OpCode.RETURN)
                {
                    Code.Nil();
                    Code.Instructions.Add(OpCode.RETURN);
                }
            }
                                  );
        }
Пример #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="FlyParser.methodDefinition"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitMethodDefinition([NotNull] FlyParser.MethodDefinitionContext context)
 {
 }