decaffeinate-parser
Advanced tools
Comparing version 19.1.1 to 19.1.2
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
exports.__esModule = true; | ||
var SourceType_1 = require("coffee-lex/dist/SourceType"); | ||
var nodes_1 = require("decaffeinate-coffeescript/lib/coffee-script/nodes"); | ||
@@ -18,3 +27,3 @@ var fixInvalidLocationData_1 = require("./fixInvalidLocationData"); | ||
if (node instanceof nodes_1.Value) { | ||
var lastChild = node.properties[node.properties.length - 1]; | ||
var lastChild = node.properties[node.properties.length - 1] || node.base; | ||
if (lastChild) { | ||
@@ -167,3 +176,21 @@ node.locationData = locationWithLastPosition_1["default"](node.locationData, lastChild.locationData); | ||
} | ||
if (node instanceof nodes_1.Literal) { | ||
// Heregexp flags have an incorrect location, so detect that case and adjust | ||
// the end location to be correct. | ||
var endIndex = linesAndColumns.indexForLocation({ | ||
line: node.locationData.last_line, | ||
column: node.locationData.last_column | ||
}); | ||
if (endIndex !== null) { | ||
var tokenIndex = context.sourceTokens.indexOfTokenNearSourceIndex(endIndex); | ||
var token = context.sourceTokens.tokenAtIndex(tokenIndex); | ||
if (token && token.type === SourceType_1["default"].HEREGEXP_END) { | ||
var location = linesAndColumns.locationForIndex(token.end - 1); | ||
if (location) { | ||
node.locationData = __assign({}, node.locationData, { last_line: location.line, last_column: location.column }); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
exports["default"] = fixLocations; |
@@ -1,1 +0,1 @@ | ||
{"name":"decaffeinate-parser","description":"A better AST for CoffeeScript, inspired by CoffeeScriptRedux.","version":"19.1.1","main":"dist/parser.js","module":"dist/parser.mjs","types":"dist/parser.d.ts","scripts":{"build":"./script/build","lint":"eslint src test && tslint --config tslint.json --project tsconfig.json --type-check","lint-fix":"eslint src test --fix && tslint --config tslint.json --project tsconfig.json --type-check --fix","pretest":"npm run lint","test":"mocha"},"keywords":["coffeescript","ast","parse"],"author":"Brian Donovan","license":"MIT","files":["dist/"],"dependencies":{"@types/babylon":"^6.16.1","@types/json-stable-stringify":"^1.0.31","babylon":"^6.14.1","coffee-lex":"^8.0.0","decaffeinate-coffeescript":"1.10.0-patch26","json-stable-stringify":"^1.0.1","lines-and-columns":"^1.1.6"},"devDependencies":{"@types/mocha":"^2.2.35","@types/node":"8.0.46","babel":"^6.5.2","babel-eslint":"^8.0.1","babel-plugin-external-helpers":"^6.8.0","babel-plugin-object-rest-spread":"0.0.0","babel-plugin-syntax-flow":"^6.8.0","babel-plugin-syntax-object-rest-spread":"^6.8.0","babel-plugin-transform-flow-strip-types":"^6.21.0","babel-plugin-transform-object-rest-spread":"^6.20.1","babel-preset-es2015":"^6.13.0","babel-register":"^6.7.2","coffee-script-redux":"^2.0.0-beta8","eslint":"^4.1.0","mocha":"^4.0.0","semantic-release":"^8.2.0","string-repeat":"^1.1.1","ts-node":"^3.2.0","tslint":"^5.5.0","typescript":"^2.4.1"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"repository":{"type":"git","url":"https://github.com/decaffeinate/decaffeinate-parser.git"}} | ||
{"name":"decaffeinate-parser","description":"A better AST for CoffeeScript, inspired by CoffeeScriptRedux.","version":"19.1.2","main":"dist/parser.js","module":"dist/parser.mjs","types":"dist/parser.d.ts","scripts":{"build":"./script/build","lint":"eslint src test && tslint --config tslint.json --project tsconfig.json --type-check","lint-fix":"eslint src test --fix && tslint --config tslint.json --project tsconfig.json --type-check --fix","pretest":"npm run lint","test":"mocha"},"keywords":["coffeescript","ast","parse"],"author":"Brian Donovan","license":"MIT","files":["dist/"],"dependencies":{"@types/babylon":"^6.16.1","@types/json-stable-stringify":"^1.0.31","babylon":"^6.14.1","coffee-lex":"^8.0.0","decaffeinate-coffeescript":"1.10.0-patch26","json-stable-stringify":"^1.0.1","lines-and-columns":"^1.1.6"},"devDependencies":{"@types/mocha":"^2.2.35","@types/node":"8.0.46","babel":"^6.5.2","babel-eslint":"^8.0.1","babel-plugin-external-helpers":"^6.8.0","babel-plugin-object-rest-spread":"0.0.0","babel-plugin-syntax-flow":"^6.8.0","babel-plugin-syntax-object-rest-spread":"^6.8.0","babel-plugin-transform-flow-strip-types":"^6.21.0","babel-plugin-transform-object-rest-spread":"^6.20.1","babel-preset-es2015":"^6.13.0","babel-register":"^6.7.2","coffee-script-redux":"^2.0.0-beta8","eslint":"^4.1.0","mocha":"^4.0.0","semantic-release":"^8.2.0","string-repeat":"^1.1.1","ts-node":"^3.2.0","tslint":"^5.5.0","typescript":"^2.4.1"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"repository":{"type":"git","url":"https://github.com/decaffeinate/decaffeinate-parser.git"}} |
Sorry, the diff of this file is not supported yet
330089
7568