forked from jasder/antlr
Fix for a weird lambda execution problem in Windows.
One of the lambdas used in a "finally" expression executed already while defining the "finally" instance, which is way too early of course (others did not show this behavior), which happens only with the Visual Studio compiler, not clang. By changing the capture list to a general reference capture things started working as they should.
This commit is contained in:
parent
8ff852640a
commit
0fada33ceb
|
@ -491,19 +491,19 @@ Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(<c
|
|||
}
|
||||
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(int precedence<currentRule.args:{a | , <a>}>) {
|
||||
Ref\<ParserRuleContext> parentContext = _ctx;
|
||||
int parentState = getState();
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> result = std::make_shared\<<currentRule.ctxType>\>(_ctx, parentState<currentRule.args: {a | , <a.name>}>);
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> previousContext = result;
|
||||
int startState = <currentRule.startState>;
|
||||
enterRecursionRule(result, <currentRule.startState>, <parser.name>Rule::Rule<currentRule.name; format = "cap">, precedence);
|
||||
Ref\<ParserRuleContext> parentContext = _ctx;
|
||||
int parentState = getState();
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> result = std::make_shared\<<currentRule.ctxType>\>(_ctx, parentState<currentRule.args: {a | , <a.name>}>);
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> previousContext = result;
|
||||
int startState = <currentRule.startState>;
|
||||
enterRecursionRule(result, <currentRule.startState>, <parser.name>Rule::Rule<currentRule.name; format = "cap">, precedence);
|
||||
|
||||
<namedActions.init>
|
||||
<! TODO: untested !> <locals; separator = "\n">
|
||||
|
||||
auto onExit = finally([this, parentContext] {
|
||||
auto onExit = finally([&] {
|
||||
<! TODO: untested !><if (finallyAction)><finallyAction><endif>
|
||||
unrollRecursionContexts(parentContext);
|
||||
unrollRecursionContexts(parentContext);
|
||||
});
|
||||
try {
|
||||
<if (currentRule.hasLookaheadBlock)>int alt;<endif>
|
||||
|
|
Loading…
Reference in New Issue