New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

decaffeinate-parser

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decaffeinate-parser - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

112

dist/decaffeinate-parser.es6.js
import * as CoffeeScript from 'coffee-script';
import binarySearch from 'binary-search';
import lex, { HERECOMMENT, COMMENT, NEWLINE } from 'coffee-lex';
import { inspect } from 'util';
import binarySearch from 'binary-search';

@@ -188,2 +188,3 @@ var babelHelpers = {};

babelHelpers.createClass(ParseContext, [{

@@ -293,3 +294,3 @@ key: 'getRange',

var startToken = this.tokenAtIndex(index);
var expectedEndTokenType = undefined;
var expectedEndTokenType = void 0;
switch (startToken.type) {

@@ -560,3 +561,3 @@ case 'PARAM_START':

while (p < string.length - quote.length) {
var chr = undefined;
var chr = void 0;
switch (chr = string[p++]) {

@@ -788,5 +789,5 @@ case '\\':

last = lastBalancedIndex;
var lastLoc = mapper.invert(last);
loc.last_line = lastLoc.line;
loc.last_column = lastLoc.column;
var _lastLoc = mapper.invert(last);
loc.last_line = _lastLoc.line;
loc.last_column = _lastLoc.column;
}

@@ -866,6 +867,6 @@ }

function mergeLocations(left, right) {
var first_line = undefined;
var first_column = undefined;
var last_line = undefined;
var last_column = undefined;
var first_line = void 0;
var first_column = void 0;
var last_line = void 0;
var last_column = void 0;

@@ -960,4 +961,4 @@ if (left.first_line < right.first_line) {

if (isImplicitObject) {
var lastChild = node.properties[node.properties.length - 1];
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild = node.properties[node.properties.length - 1];
node.locationData = locationWithLastPosition(node.locationData, _lastChild.locationData);
}

@@ -969,5 +970,5 @@ break;

{
var lastChild = node.second;
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild2 = node.second;
if (_lastChild2) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild2.locationData);
}

@@ -979,4 +980,4 @@ break;

{
var lastChild = node.value;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild3 = node.value;
node.locationData = locationWithLastPosition(node.locationData, _lastChild3.locationData);
break;

@@ -987,4 +988,4 @@ }

{
var lastChild = node.array;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild4 = node.array;
node.locationData = locationWithLastPosition(node.locationData, _lastChild4.locationData);
break;

@@ -1005,5 +1006,5 @@ }

if (isImplicitCall) {
var lastChild = node.args[node.args.length - 1] || node.variable;
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild5 = node.args[node.args.length - 1] || node.variable;
if (_lastChild5) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild5.locationData);
}

@@ -1017,5 +1018,5 @@ }

{
var lastChild = node.expressions[node.expressions.length - 1];
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild6 = node.expressions[node.expressions.length - 1];
if (_lastChild6) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild6.locationData);
}

@@ -1027,4 +1028,4 @@ break;

{
var lastChild = node.elseBody || node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild7 = node.elseBody || node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild7.locationData);
break;

@@ -1036,4 +1037,4 @@ }

{
var lastChild = node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild8 = node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild8.locationData);
break;

@@ -1045,4 +1046,4 @@ }

if (!node.splat) {
var lastChild = node.value || node.name;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild9 = node.value || node.name;
node.locationData = locationWithLastPosition(node.locationData, _lastChild9.locationData);
}

@@ -1062,4 +1063,4 @@ break;

{
var lastChild = node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild10 = node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild10.locationData);
break;

@@ -1070,4 +1071,4 @@ }

{
var lastChild = node.otherwise || node.cases[node.cases.length - 1][1];
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild11 = node.otherwise || node.cases[node.cases.length - 1][1];
node.locationData = locationWithLastPosition(node.locationData, _lastChild11.locationData);
break;

@@ -1078,4 +1079,4 @@ }

{
var lastChild = node.ensure || node.recovery || node.errorVariable || node.attempt;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild12 = node.ensure || node.recovery || node.errorVariable || node.attempt;
node.locationData = locationWithLastPosition(node.locationData, _lastChild12.locationData);
break;

@@ -1086,4 +1087,4 @@ }

{
var lastChild = node.parent;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild13 = node.parent;
node.locationData = locationWithLastPosition(node.locationData, _lastChild13.locationData);
break;

@@ -1378,4 +1379,4 @@ }

block.inline = false;
for (var i = block.range[0] - 1; i >= 0; i--) {
var char = source[i];
for (var _i = block.range[0] - 1; _i >= 0; _i--) {
var char = source[_i];
if (char === '\n') {

@@ -1461,4 +1462,4 @@ break;

expr.base.properties.forEach(function (property) {
var key = undefined;
var value = undefined;
var key = void 0;
var value = void 0;
switch (type(property)) {

@@ -1480,2 +1481,3 @@ case 'Value':

statements.push(ctor = makeNode('Constructor', property.locationData, {
assignee: key,
expression: value

@@ -1603,7 +1605,7 @@ }));

if (loc) {
var start = mapper(loc.first_line, loc.first_column);
var end = mapper(loc.last_line, loc.last_column) + 1;
var _start = mapper(loc.first_line, loc.first_column);
var _end = mapper(loc.last_line, loc.last_column) + 1;
result.line = loc.first_line + 1;
result.column = loc.first_column + 1;
result.range = [start, end];
result.range = [_start, _end];
} else {

@@ -1614,6 +1616,6 @@ result.virtual = true;

if (attrs.hasOwnProperty(key)) {
var value = attrs[key];
result[key] = value;
if (value && result.range) {
(Array.isArray(value) ? value : [value]).forEach(function (node) {
var _value = attrs[key];
result[key] = _value;
if (_value && result.range) {
(Array.isArray(_value) ? _value : [_value]).forEach(function (node) {
if (node.range) {

@@ -1907,3 +1909,3 @@ // Expand the range to contain all the children.

function convertOperator(op) {
var nodeType = undefined;
var nodeType = void 0;

@@ -1917,10 +1919,10 @@ if (op.second) {

var result = makeNode(nodeType, op.locationData, {
var _result2 = makeNode(nodeType, op.locationData, {
left: convertNode(op.first, [].concat(babelHelpers.toConsumableArray(ancestors), [op])),
right: convertNode(op.second, [].concat(babelHelpers.toConsumableArray(ancestors), [op]))
});
if (result.type === 'InstanceofOp' || result.type === 'OfOp') {
result.isNot = op.inverted === true;
if (_result2.type === 'InstanceofOp' || _result2.type === 'OfOp') {
_result2.isNot = op.inverted === true;
}
return result;
return _result2;
} else {

@@ -1927,0 +1929,0 @@ switch (op.operator) {

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('coffee-script'), require('coffee-lex'), require('util'), require('binary-search')) :
typeof define === 'function' && define.amd ? define(['exports', 'coffee-script', 'coffee-lex', 'util', 'binary-search'], factory) :
(factory((global.decaffeinate = global.decaffeinate || {}, global.decaffeinate.parser = {}),global.CoffeeScript,global.lex,global.util,global.binarySearch));
}(this, function (exports,CoffeeScript,lex,util,binarySearch) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('coffee-script'), require('binary-search'), require('coffee-lex'), require('util')) :
typeof define === 'function' && define.amd ? define(['exports', 'coffee-script', 'binary-search', 'coffee-lex', 'util'], factory) :
(factory((global.decaffeinate = global.decaffeinate || {}, global.decaffeinate.parser = global.decaffeinate.parser || {}),global.CoffeeScript,global.binarySearch,global.lex,global.util));
}(this, function (exports,CoffeeScript,binarySearch,lex,util) { 'use strict';
binarySearch = 'default' in binarySearch ? binarySearch['default'] : binarySearch;
var lex__default = 'default' in lex ? lex['default'] : lex;
binarySearch = 'default' in binarySearch ? binarySearch['default'] : binarySearch;

@@ -192,2 +192,3 @@ var babelHelpers = {};

babelHelpers.createClass(ParseContext, [{

@@ -297,3 +298,3 @@ key: 'getRange',

var startToken = this.tokenAtIndex(index);
var expectedEndTokenType = undefined;
var expectedEndTokenType = void 0;
switch (startToken.type) {

@@ -564,3 +565,3 @@ case 'PARAM_START':

while (p < string.length - quote.length) {
var chr = undefined;
var chr = void 0;
switch (chr = string[p++]) {

@@ -792,5 +793,5 @@ case '\\':

last = lastBalancedIndex;
var lastLoc = mapper.invert(last);
loc.last_line = lastLoc.line;
loc.last_column = lastLoc.column;
var _lastLoc = mapper.invert(last);
loc.last_line = _lastLoc.line;
loc.last_column = _lastLoc.column;
}

@@ -870,6 +871,6 @@ }

function mergeLocations(left, right) {
var first_line = undefined;
var first_column = undefined;
var last_line = undefined;
var last_column = undefined;
var first_line = void 0;
var first_column = void 0;
var last_line = void 0;
var last_column = void 0;

@@ -964,4 +965,4 @@ if (left.first_line < right.first_line) {

if (isImplicitObject) {
var lastChild = node.properties[node.properties.length - 1];
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild = node.properties[node.properties.length - 1];
node.locationData = locationWithLastPosition(node.locationData, _lastChild.locationData);
}

@@ -973,5 +974,5 @@ break;

{
var lastChild = node.second;
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild2 = node.second;
if (_lastChild2) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild2.locationData);
}

@@ -983,4 +984,4 @@ break;

{
var lastChild = node.value;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild3 = node.value;
node.locationData = locationWithLastPosition(node.locationData, _lastChild3.locationData);
break;

@@ -991,4 +992,4 @@ }

{
var lastChild = node.array;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild4 = node.array;
node.locationData = locationWithLastPosition(node.locationData, _lastChild4.locationData);
break;

@@ -1009,5 +1010,5 @@ }

if (isImplicitCall) {
var lastChild = node.args[node.args.length - 1] || node.variable;
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild5 = node.args[node.args.length - 1] || node.variable;
if (_lastChild5) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild5.locationData);
}

@@ -1021,5 +1022,5 @@ }

{
var lastChild = node.expressions[node.expressions.length - 1];
if (lastChild) {
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild6 = node.expressions[node.expressions.length - 1];
if (_lastChild6) {
node.locationData = locationWithLastPosition(node.locationData, _lastChild6.locationData);
}

@@ -1031,4 +1032,4 @@ break;

{
var lastChild = node.elseBody || node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild7 = node.elseBody || node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild7.locationData);
break;

@@ -1040,4 +1041,4 @@ }

{
var lastChild = node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild8 = node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild8.locationData);
break;

@@ -1049,4 +1050,4 @@ }

if (!node.splat) {
var lastChild = node.value || node.name;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild9 = node.value || node.name;
node.locationData = locationWithLastPosition(node.locationData, _lastChild9.locationData);
}

@@ -1066,4 +1067,4 @@ break;

{
var lastChild = node.body;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild10 = node.body;
node.locationData = locationWithLastPosition(node.locationData, _lastChild10.locationData);
break;

@@ -1074,4 +1075,4 @@ }

{
var lastChild = node.otherwise || node.cases[node.cases.length - 1][1];
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild11 = node.otherwise || node.cases[node.cases.length - 1][1];
node.locationData = locationWithLastPosition(node.locationData, _lastChild11.locationData);
break;

@@ -1082,4 +1083,4 @@ }

{
var lastChild = node.ensure || node.recovery || node.errorVariable || node.attempt;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild12 = node.ensure || node.recovery || node.errorVariable || node.attempt;
node.locationData = locationWithLastPosition(node.locationData, _lastChild12.locationData);
break;

@@ -1090,4 +1091,4 @@ }

{
var lastChild = node.parent;
node.locationData = locationWithLastPosition(node.locationData, lastChild.locationData);
var _lastChild13 = node.parent;
node.locationData = locationWithLastPosition(node.locationData, _lastChild13.locationData);
break;

@@ -1382,4 +1383,4 @@ }

block.inline = false;
for (var i = block.range[0] - 1; i >= 0; i--) {
var char = source[i];
for (var _i = block.range[0] - 1; _i >= 0; _i--) {
var char = source[_i];
if (char === '\n') {

@@ -1465,4 +1466,4 @@ break;

expr.base.properties.forEach(function (property) {
var key = undefined;
var value = undefined;
var key = void 0;
var value = void 0;
switch (type(property)) {

@@ -1484,2 +1485,3 @@ case 'Value':

statements.push(ctor = makeNode('Constructor', property.locationData, {
assignee: key,
expression: value

@@ -1607,7 +1609,7 @@ }));

if (loc) {
var start = mapper(loc.first_line, loc.first_column);
var end = mapper(loc.last_line, loc.last_column) + 1;
var _start = mapper(loc.first_line, loc.first_column);
var _end = mapper(loc.last_line, loc.last_column) + 1;
result.line = loc.first_line + 1;
result.column = loc.first_column + 1;
result.range = [start, end];
result.range = [_start, _end];
} else {

@@ -1618,6 +1620,6 @@ result.virtual = true;

if (attrs.hasOwnProperty(key)) {
var value = attrs[key];
result[key] = value;
if (value && result.range) {
(Array.isArray(value) ? value : [value]).forEach(function (node) {
var _value = attrs[key];
result[key] = _value;
if (_value && result.range) {
(Array.isArray(_value) ? _value : [_value]).forEach(function (node) {
if (node.range) {

@@ -1911,3 +1913,3 @@ // Expand the range to contain all the children.

function convertOperator(op) {
var nodeType = undefined;
var nodeType = void 0;

@@ -1921,10 +1923,10 @@ if (op.second) {

var result = makeNode(nodeType, op.locationData, {
var _result2 = makeNode(nodeType, op.locationData, {
left: convertNode(op.first, [].concat(babelHelpers.toConsumableArray(ancestors), [op])),
right: convertNode(op.second, [].concat(babelHelpers.toConsumableArray(ancestors), [op]))
});
if (result.type === 'InstanceofOp' || result.type === 'OfOp') {
result.isNot = op.inverted === true;
if (_result2.type === 'InstanceofOp' || _result2.type === 'OfOp') {
_result2.isNot = op.inverted === true;
}
return result;
return _result2;
} else {

@@ -1931,0 +1933,0 @@ switch (op.operator) {

{
"name": "decaffeinate-parser",
"version": "1.2.3",
"version": "1.2.4",
"description": "A better AST for CoffeeScript, inspired by CoffeeScriptRedux.",

@@ -5,0 +5,0 @@ "main": "dist/decaffeinate-parser.umd.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc