Wrap callback in try/finally

This ensures we clean up always if the callback throws.
This commit is contained in:
James DiGioia 2018-07-22 18:50:29 -04:00
parent afd0638b74
commit 094ef31c01

View File

@ -2131,10 +2131,11 @@ export default class ExpressionParser extends LValParser {
maxTopicIndex: null,
};
const callbackResult = callback();
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
return callbackResult;
}
}
// Disable topic references from outer contexts within syntax constructs
@ -2153,10 +2154,11 @@ export default class ExpressionParser extends LValParser {
maxTopicIndex: null,
};
const callbackResult = callback();
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
return callbackResult;
}
}
// Register the use of a primary topic reference (`#`) within the current