Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ExecutionPathOptions to all bind calls
* Make sure bindxyz and hasEffectsWhenxyz are as symmetric as possible so that in the future, we could make this the same function and possibly remove assignment/call binding from the bind phase * Add the calling node to CallOptions to have a break-off condition that works for well return value assertions This all resolves a maximum call stack error
- Loading branch information
1 parent
e2daaec
commit 52f4684
Showing
35 changed files
with
230 additions
and
223 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,15 @@ | ||
import Immutable from 'immutable'; | ||
|
||
const RESULT_KEY = {}; | ||
|
||
export default class CallOptions { | ||
static create ( callOptions ) { | ||
return new this( callOptions, Immutable.Map() ); | ||
return new this( callOptions ); | ||
} | ||
|
||
constructor ( { withNew = false, args = [] } = {}, nodesCalledAtPath ) { | ||
constructor ( { withNew = false, args = [], caller } = {} ) { | ||
this.withNew = withNew; | ||
this.args = args; | ||
this._nodesCalledAtPath = nodesCalledAtPath; | ||
} | ||
|
||
addCalledNodeAtPath ( path, node ) { | ||
return new this.constructor( this, this._nodesCalledAtPath.setIn( [ node, ...path, RESULT_KEY ], true ) ); | ||
this.caller = caller; | ||
} | ||
|
||
equals ( callOptions ) { | ||
return this.withNew === callOptions.withNew | ||
&& this.args.length === callOptions.args.length | ||
&& this.args.every( ( parameter, index ) => parameter === callOptions.args[ index ] ); | ||
} | ||
|
||
hasNodeBeenCalledAtPath ( path, node ) { | ||
return this._nodesCalledAtPath.getIn( [ node, ...path, RESULT_KEY ] ); | ||
return callOptions && this.caller === callOptions.caller; | ||
} | ||
} |
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
Oops, something went wrong.