-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50c5355
commit 0183368
Showing
13 changed files
with
87 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,72 @@ | ||
import Node from './Node'; | ||
import ExecutionPathOptions from './ExecutionPathOptions'; | ||
import CallOptions from './CallOptions'; | ||
import Variable from './variables/Variable'; | ||
|
||
export const UNKNOWN_VALUE = { toString: () => '[[UNKNOWN]]' }; | ||
|
||
export type PredicateFunction = (node: Node | UnknownAssignment | UndefinedAssignment) => boolean; | ||
export type PredicateFunction = (node: Variable | Node | UnknownAssignment | UndefinedAssignment) => boolean; | ||
|
||
export interface UnknownAssignment { | ||
type: 'UNKNOWN'; | ||
reassignPath: () => void; | ||
forEachReturnExpressionWhenCalledAtPath: () => void; | ||
hasEffectsWhenAccessedAtPath: (path: string[], _options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenAssignedAtPath: (path: string[], _options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenCalledAtPath: () => true; | ||
someReturnExpressionWhenCalledAtPath: () => true; | ||
reassignPath: (path: string[], options: ExecutionPathOptions) => void; | ||
forEachReturnExpressionWhenCalledAtPath: ( | ||
path: string[], | ||
callOptions: CallOptions, | ||
callback: (options: ExecutionPathOptions) => (node: Node) => void, | ||
options: ExecutionPathOptions | ||
) => void; | ||
hasEffectsWhenAccessedAtPath: (path: string[], options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenAssignedAtPath: (path: string[], options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenCalledAtPath: (_path: string[], _callOptions: CallOptions, _options: ExecutionPathOptions) => true; | ||
someReturnExpressionWhenCalledAtPath: ( | ||
path: string[], | ||
callOptions: CallOptions, | ||
callback: (options: ExecutionPathOptions) => PredicateFunction, | ||
options: ExecutionPathOptions | ||
) => boolean; | ||
toString: () => '[[UNKNOWN]]'; | ||
}; | ||
|
||
export interface UndefinedAssignment { | ||
type: 'UNDEFINED'; | ||
reassignPath: () => void; | ||
forEachReturnExpressionWhenCalledAtPath: () => void; | ||
reassignPath: (path: string[], options: ExecutionPathOptions) => void; | ||
forEachReturnExpressionWhenCalledAtPath: ( | ||
path: string[], | ||
callOptions: CallOptions, | ||
callback: (options: ExecutionPathOptions) => (node: Node) => void, | ||
options: ExecutionPathOptions | ||
) => void; | ||
hasEffectsWhenAccessedAtPath: (path: string[], _options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenAssignedAtPath: (path: string[], _options: ExecutionPathOptions) => boolean; | ||
hasEffectsWhenCalledAtPath: (_path: string[], _callOptions: CallOptions, _options: ExecutionPathOptions) => true; | ||
someReturnExpressionWhenCalledAtPath: () => true; | ||
someReturnExpressionWhenCalledAtPath: ( | ||
path: string[], | ||
callOptions: CallOptions, | ||
callback: (options: ExecutionPathOptions) => PredicateFunction, | ||
options: ExecutionPathOptions | ||
) => boolean; | ||
toString: () => '[[UNDEFINED]]'; | ||
}; | ||
|
||
export const UNKNOWN_ASSIGNMENT: UnknownAssignment = { | ||
type: 'UNKNOWN', | ||
reassignPath: () => { }, | ||
forEachReturnExpressionWhenCalledAtPath: () => { }, | ||
hasEffectsWhenAccessedAtPath: (path: string[], _options: ExecutionPathOptions) => path.length > 0, | ||
hasEffectsWhenAssignedAtPath: (path: string[], _options: ExecutionPathOptions) => path.length > 0, | ||
hasEffectsWhenCalledAtPath: () => true, | ||
someReturnExpressionWhenCalledAtPath: () => true, | ||
reassignPath: (_path, _options) => {}, | ||
forEachReturnExpressionWhenCalledAtPath: (_path, _callOptions, _callback, _options) => {}, | ||
hasEffectsWhenAccessedAtPath: (path, _options) => path.length > 0, | ||
hasEffectsWhenAssignedAtPath: (path, _options) => path.length > 0, | ||
hasEffectsWhenCalledAtPath: (_path, _callOptions, _options) => true, | ||
someReturnExpressionWhenCalledAtPath: (_path, _callOptions, _callback, _options) => true, | ||
toString: () => '[[UNKNOWN]]' | ||
}; | ||
|
||
export const UNDEFINED_ASSIGNMENT: UndefinedAssignment = { | ||
type: 'UNDEFINED', | ||
reassignPath: () => { }, | ||
forEachReturnExpressionWhenCalledAtPath: () => { }, | ||
hasEffectsWhenAccessedAtPath: (path: string[], _options: ExecutionPathOptions) => path.length > 0, | ||
hasEffectsWhenAssignedAtPath: (path: string[], _options: ExecutionPathOptions) => path.length > 0, | ||
hasEffectsWhenCalledAtPath: (_path: string[], _callOptions: CallOptions, _options: ExecutionPathOptions) => true, | ||
someReturnExpressionWhenCalledAtPath: () => true, | ||
reassignPath: (_path, _options) => {}, | ||
forEachReturnExpressionWhenCalledAtPath: (_path, _callOptions, _callback, _options) => {}, | ||
hasEffectsWhenAccessedAtPath: (path, _options) => path.length > 0, | ||
hasEffectsWhenAssignedAtPath: (path, _options) => path.length > 0, | ||
hasEffectsWhenCalledAtPath: (_path, _callOptions, _options) => true, | ||
someReturnExpressionWhenCalledAtPath: (_path, _callOptions, _callback, _options) => true, | ||
toString: () => '[[UNDEFINED]]' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters