Wrap callback in try/finally
This ensures we clean up always if the callback throws.
This commit is contained in:
parent
afd0638b74
commit
094ef31c01
@ -2131,10 +2131,11 @@ export default class ExpressionParser extends LValParser {
|
|||||||
maxTopicIndex: null,
|
maxTopicIndex: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const callbackResult = callback();
|
try {
|
||||||
|
return callback();
|
||||||
|
} finally {
|
||||||
this.state.topicContext = outerContextTopicState;
|
this.state.topicContext = outerContextTopicState;
|
||||||
return callbackResult;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable topic references from outer contexts within syntax constructs
|
// Disable topic references from outer contexts within syntax constructs
|
||||||
@ -2153,10 +2154,11 @@ export default class ExpressionParser extends LValParser {
|
|||||||
maxTopicIndex: null,
|
maxTopicIndex: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const callbackResult = callback();
|
try {
|
||||||
|
return callback();
|
||||||
|
} finally {
|
||||||
this.state.topicContext = outerContextTopicState;
|
this.state.topicContext = outerContextTopicState;
|
||||||
return callbackResult;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the use of a primary topic reference (`#`) within the current
|
// Register the use of a primary topic reference (`#`) within the current
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user