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

--- Comment #3 from RazvanN <razvan.nitu1...@gmail.com> ---
(In reply to Iain Buclaw from comment #2)
> (In reply to RazvanN from comment #1)
> > 1. We can implement the expected behavior by attaching the pragma to the
> > declaration, but given the existing machinery in the compiler this will
> > require a lot of rework to transform the existing pragma statement into a
> > pragma declaration and hook in to the existing implementation.
> Why do you think so?
> 
> The parser looks like this:
> ---
> if (token.value == TOK.semicolon)
> {
>     nextToken();
>     _body = null;
> }
> else
>     _body = parseStatement(ParseStatementFlags.semi);
> s = new AST.PragmaStatement(loc, ident, args, _body);
> break;
> ---
> 
> A standalone `pragma(inline);` statement will have no `_body`.  This can be
> checked at semantic with no invasive changes.

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).

--

Reply via email to