Skip to content

Commit

Permalink
Fix compilation for @System AA.keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nordlow committed May 9, 2022
1 parent b8d748f commit 9fb4d41
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pegged/introspection.d
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,15 @@ pure GrammarInfo grammarInfo(ParseTree p)
idList[p.matches[0]] = true;
else
foreach(child; p.children)
foreach(name; findIdentifiers(child).keys)
{
auto ids = findIdentifiers(child);
static if (__VERSION__ < 2091) // .keys is @system prior to 2.091
auto keys = () @trusted { return ids.keys; } ();
else
auto keys = ids.keys;
foreach(name; keys)
idList[name] = true;
}

return idList;
}
Expand Down Expand Up @@ -157,10 +164,14 @@ pure GrammarInfo grammarInfo(ParseTree p)
while(changed)
{
changed = false;
foreach(rule1; graph.keys)
foreach(rule2; graph.keys)
static if (__VERSION__ < 2091) // .keys is @system prior to 2.091
auto keys = () @trusted { return graph.keys; } ();
else
auto keys = graph.keys;
foreach(rule1; keys)
foreach(rule2; keys)
if (rule2 in path[rule1])
foreach(rule3; graph.keys)
foreach(rule3; keys)
if (rule3 in path[rule2] && rule3 !in path[rule1])
{
path[rule1][rule3] = true;
Expand Down

0 comments on commit 9fb4d41

Please sign in to comment.