Esempio n. 1
0
        public override void EnterVarAssignment(FlyParser.VarAssignmentContext context)
        {
            var name = context.ID().GetText();

            EnterExpression(context.value);

            // Compound assignment
            if (context.op != null)
            {
                Code.GetVar(name);

                if (context.index != null)
                {
                    EnterExpression(context.index);
                    Code.ArrayGet();
                }

                Code.BinaryOperator(context.op.Text);
            }

            // Array assignment
            if (context.index != null)
            {
                EnterExpression(context.index);
                Code.GetVar(name);
                Code.ArraySet();
            }
            else
            {
                Code.SetVar(name);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="FlyParser.varAssignment"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitVarAssignment([NotNull] FlyParser.VarAssignmentContext context)
 {
 }