https://issues.dlang.org/show_bug.cgi?id=23520

--- Comment #5 from Iain Buclaw <ibuc...@gdcproject.org> ---
(In reply to RazvanN from comment #3)
> That is true, but in your original bug report you want to apply the pragma
> to the declarations inside the body, right? To be able to do that you need
> to create a PragmaDeclaration and attach it to the the scope of the pragma
> statement body (struct Scope has a field inlining of type PragmaDeclaration).
Yes, that can be handled by the statement semantic for PragmaStatement.

I think something like the following should suffice:
---
Scope* sc2 = sc;
scope(exit)
    if (sc2 != sc)
        sc2.pop();
// ...
if (ps.ident == Id.Pinline)
{
    if (auto fd = sc.func)
    {
        if (ps._body)
            sc2 = new PragmaDeclaration(...).newScope(sc);
        else
            fd.inlining = evalPragmaInline(ps.loc, sc, ps.args);
    }
    else
    {
        ps.error("`pragma(inline)` is not inside a function");
        return setError();
    }
}
// ...
if (ps._body)
{
    ps._body = ps._body.statementSemantic(sc2);
}

--

Reply via email to