Allow //pragma inline or /*pragma inline*/ for inlining a function

They are transformed by the scanner to the identifier `inline`, which is how the parser identifies it. This solves the comment problem, but it results in a funny side effect. Now, in inline mode, /*pragma inline*/ will always be the identifier `inline`, therefore this is valid:

    integer /*pragma inline*/ = 5;
    llOwnerSay((string)inline); // will say 5

Not overly elegant, but better than making up a specific token or declaring comments as tokens or the like.
This commit is contained in:
Sei Lisa 2021-10-17 20:07:33 +02:00
parent 064a8c4319
commit bf72d2c3bf
2 changed files with 18 additions and 2 deletions

View file

@ -5,12 +5,12 @@ f1() inline
llOwnerSay("f1");
}
f2(integer f2param) inline
f2(integer f2param) /*pragma inline*/
{
llOwnerSay("f2:" + (string)f2param);
}
vector f3(integer f3p1, string f3p2) inline
vector f3(integer f3p1, string f3p2) //pragma inline
{
f2(f3p1);
integer f3p1; // test shading the parameter