示例#1
0
    internal override void GenStatementCode(CompileContext compileContext, bool bGenDebug)
    {
        Label lblTop = compileContext.gen.DefineLabel();

        base.continuedest = compileContext.gen.DefineLabel();
        Label         lblBody = compileContext.gen.DefineLabel();
        StatementNode A       = (((CommonTree)base.Children[0]).ChildCount != 0) ? ((StatementNode)((CommonTree)base.Children[0]).Children[0]) : null;

        if (A != null)
        {
            foreach (baseNode n in A.EnumerateAll())
            {
                if (n is InNode)
                {
                    throw new JSRuntimeException("SyntaxError", "Invalid for/in");
                }
            }
        }
        ExpressionNode B      = (((CommonTree)base.Children[1]).ChildCount != 0) ? ((ExpressionNode)((CommonTree)base.Children[1]).Children[0]) : null;
        StatementNode  C      = (((CommonTree)base.Children[2]).ChildCount != 0) ? ((StatementNode)((CommonTree)base.Children[2]).Children[0]) : null;
        StatementNode  D      = (StatementNode)((CommonTree)base.Children[3]);
        bool           _track = compileContext.TrackImplicitReturnValue;

        if (A != null)
        {
            compileContext.TrackImplicitReturnValue = false;
            A.GenCode(compileContext);
            compileContext.TrackImplicitReturnValue = _track;
        }
        compileContext.gen.MarkLabel(lblTop);
        if (B != null)
        {
            B.GenLazyEval(compileContext, lblBody, base.breakdest);
        }
        compileContext.gen.MarkLabel(lblBody);
        D.GenCode(compileContext);
        compileContext.gen.MarkLabel(base.continuedest);
        if (C != null)
        {
            compileContext.TrackImplicitReturnValue = false;
            C.GenCode(compileContext);
            compileContext.TrackImplicitReturnValue = _track;
        }
        compileContext.gen.Emit(OpCodes.Br, lblTop);
    }