Rename topicContextState -> .topicContext

This commit is contained in:
James DiGioia
2018-07-12 23:11:55 -04:00
parent b847d40842
commit 7931f4c241
2 changed files with 11 additions and 11 deletions

View File

@@ -2118,8 +2118,8 @@ export default class ExpressionParser extends LValParser {
// had before the function was called.
withTopicPermittingContext<T>(callback: () => T): T {
const outerContextTopicState = this.state.topicContextState;
this.state.topicContextState = {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
// Enable the use of the primary topic reference.
maxNumOfResolvableTopics: 1,
// Hide the use of any topic references from outer contexts.
@@ -2128,7 +2128,7 @@ export default class ExpressionParser extends LValParser {
const callbackResult = callback();
this.state.topicContextState = outerContextTopicState;
this.state.topicContext = outerContextTopicState;
return callbackResult;
}
@@ -2140,8 +2140,8 @@ export default class ExpressionParser extends LValParser {
// had before the function was called.
withTopicForbiddingContext<T>(callback: () => T): T {
const outerContextTopicState = this.state.topicContextState;
this.state.topicContextState = {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
// Disable the use of the primary topic reference.
maxNumOfResolvableTopics: 0,
// Hide the use of any topic references from outer contexts.
@@ -2150,24 +2150,24 @@ export default class ExpressionParser extends LValParser {
const callbackResult = callback();
this.state.topicContextState = outerContextTopicState;
this.state.topicContext = outerContextTopicState;
return callbackResult;
}
// Register the use of a primary topic reference (`#`) within the current
// topic context.
registerTopicReference(): void {
this.state.topicContextState.maxTopicIndex = 0;
this.state.topicContext.maxTopicIndex = 0;
}
primaryTopicReferenceIsAllowedInCurrentTopicContext(): boolean {
return this.state.topicContextState.maxNumOfResolvableTopics >= 1;
return this.state.topicContext.maxNumOfResolvableTopics >= 1;
}
topicReferenceWasUsedInCurrentTopicContext(): boolean {
return (
this.state.topicContextState.maxTopicIndex != null &&
this.state.topicContextState.maxTopicIndex >= 0
this.state.topicContext.maxTopicIndex != null &&
this.state.topicContext.maxTopicIndex >= 0
);
}
}

View File

@@ -34,7 +34,7 @@ export default class State {
this.isIterator = false;
// Used by smartPipelines.
this.topicContextState = {
this.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: undefined,
};