This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runat-1128988: Merge increment() and decrement() into nudge()
This is a simplification I've wanted to do for ages, those functions form part of the front interface so we really should get it right before we start using it in anger. Signed-off-by: Joe Walker <[email protected]>
- Loading branch information
Showing
12 changed files
with
88 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1446,26 +1446,9 @@ Requisition.prototype.complete = function(cursor, rank) { | |
/** | ||
* Replace the current value with the lower value if such a concept exists. | ||
*/ | ||
Requisition.prototype.decrement = function(assignment) { | ||
Requisition.prototype.nudge = function(assignment, by) { | ||
This comment has been minimized.
Sorry, something went wrong.
bgrins
|
||
var ctx = this.executionContext; | ||
var val = assignment.param.type.decrement(assignment.value, ctx); | ||
return Promise.resolve(val).then(function(replacement) { | ||
if (replacement != null) { | ||
var val = assignment.param.type.stringify(replacement, ctx); | ||
return Promise.resolve(val).then(function(str) { | ||
var arg = assignment.arg.beget({ text: str }); | ||
return this.setAssignment(assignment, arg); | ||
}.bind(this)); | ||
} | ||
}.bind(this)); | ||
}; | ||
|
||
/** | ||
* Replace the current value with the higher value if such a concept exists. | ||
*/ | ||
Requisition.prototype.increment = function(assignment) { | ||
var ctx = this.executionContext; | ||
var val = assignment.param.type.increment(assignment.value, ctx); | ||
var val = assignment.param.type.nudge(assignment.value, by, ctx); | ||
return Promise.resolve(val).then(function(replacement) { | ||
if (replacement != null) { | ||
var val = assignment.param.type.stringify(replacement, ctx); | ||
|
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.
Following "function" (not plural anymore)