Пример #1
0
    private void Build(DBreak node, Hints hints, CompilerContext ctx)
    {
        if (ctx.BlockExit.IsEmpty())
        {
            AddError(CompilerError.NoEnclosingLoop, node.Location);
        }

        if (node.Expression is not null)
        {
            Build(node.Expression, hints.Append(Push), ctx);
        }
        else
        {
            cw.PushNil();
        }

        CallAutosForKind(ScopeKind.Loop);
        AddLinePragma(node);
        cw.Br(ctx.BlockBreakExit);
    }
Пример #2
0
        private void Build(DBreak node, Hints hints, CompilerContext ctx)
        {
            if (ctx.BlockExit.IsEmpty())
            {
                AddError(CompilerError.NoEnclosingLoop, node.Location);
            }

            if (node.Expression != null)
            {
                Build(node.Expression, hints.Append(Push), ctx);
                if (!hints.Has(ExpectPush))
                {
                    cw.Pop();
                }
            }
            else if (hints.Has(ExpectPush))
            {
                cw.PushNil();
            }

            AddLinePragma(node);
            cw.Br(ctx.BlockBreakExit);
        }