mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
default to forceUpdateLocation
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
// is added to the first parameter passed in, and the parameter is returned.
|
||||
// If the parameter is not a node, it will just be passed through unaffected.
|
||||
getAddDataToNodeFunctionString = function(first, last) {
|
||||
return `yy.addDataToNode(yy, @${first}, ${last ? `@${last}` : 'null'}, {forceUpdateLocation: true})`;
|
||||
return `yy.addDataToNode(yy, {first: @${first}, ${last ? `last: @${last}, ` : ''}})`;
|
||||
};
|
||||
action = action.replace(/LOC\(([0-9]*)\)/g, getAddDataToNodeFunctionString('$1'));
|
||||
action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, getAddDataToNodeFunctionString('$1', '$2'));
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
// This returns a function which takes an object as a parameter, and if that
|
||||
// object is an AST node, updates that object's locationData.
|
||||
// The object is returned either way.
|
||||
exports.addDataToNode = function(parserState, first, last, {forceUpdateLocation} = {}) {
|
||||
exports.addDataToNode = function(parserState, {first, last, forceUpdateLocation = true}) {
|
||||
return function(obj) {
|
||||
var objHash, ref1;
|
||||
// Add location data.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,7 +45,7 @@ o = (patternString, action, options) ->
|
||||
# is added to the first parameter passed in, and the parameter is returned.
|
||||
# If the parameter is not a node, it will just be passed through unaffected.
|
||||
getAddDataToNodeFunctionString = (first, last) ->
|
||||
"yy.addDataToNode(yy, @#{first}, #{if last then "@#{last}" else 'null'}, {forceUpdateLocation: true})"
|
||||
"yy.addDataToNode(yy, {first: @#{first}, #{if last then "last: @#{last}, " else ''}})"
|
||||
|
||||
action = action.replace /LOC\(([0-9]*)\)/g, getAddDataToNodeFunctionString('$1')
|
||||
action = action.replace /LOC\(([0-9]*),\s*([0-9]*)\)/g, getAddDataToNodeFunctionString('$1', '$2')
|
||||
|
||||
@@ -136,7 +136,7 @@ buildTokenDataDictionary = (parserState) ->
|
||||
# This returns a function which takes an object as a parameter, and if that
|
||||
# object is an AST node, updates that object's locationData.
|
||||
# The object is returned either way.
|
||||
exports.addDataToNode = (parserState, first, last, {forceUpdateLocation} = {}) ->
|
||||
exports.addDataToNode = (parserState, {first, last, forceUpdateLocation = yes}) ->
|
||||
(obj) ->
|
||||
# Add location data.
|
||||
if obj?.updateLocationDataIfMissing? and first?
|
||||
|
||||
Reference in New Issue
Block a user