Huge News!Announcing our $40M Series B led by Abstract Ventures.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 22.4.0 to 22.4.1

dist/util/expandToIncludeParens.d.ts

5

dist/util/fixLocations.js

@@ -13,2 +13,3 @@ "use strict";

var nodes_1 = require("decaffeinate-coffeescript2/lib/coffeescript/nodes");
var expandToIncludeParens_1 = require("./expandToIncludeParens");
var fixInvalidLocationData_1 = require("./fixInvalidLocationData");

@@ -140,2 +141,6 @@ var locationWithLastPosition_1 = require("./locationWithLastPosition");

}
// The CS2 AST doesn't include the surrounding parens in a block, which can cause trouble with
// things like postfix loops with parenthesized bodies. Expand every block to include any
// surrounding parens.
node.locationData = expandToIncludeParens_1["default"](context, node.locationData);
}

@@ -142,0 +147,0 @@ if (node instanceof nodes_1.If) {

3

dist/util/getLocation.d.ts

@@ -0,1 +1,2 @@

import SourceToken from 'coffee-lex/dist/SourceToken';
import { Base } from 'decaffeinate-coffeescript2/lib/coffeescript/nodes';

@@ -11,1 +12,3 @@ import ParseContext from './ParseContext';

export default function getLocation(context: ParseContext, node: Base): NodeLocation;
export declare function firstSemanticTokenAfter(context: ParseContext, index: number): SourceToken | null;
export declare function firstSemanticTokenBefore(context: ParseContext, index: number): SourceToken | null;

20

dist/util/getLocation.js

@@ -22,4 +22,4 @@ "use strict";

}
var firstTokenOfNode = firstSemanticTokenAfter(context, start, node);
var lastTokenOfNode = firstSemanticTokenBefore(context, end, node);
var firstTokenOfNode = requireToken(firstSemanticTokenAfter(context, start), node);
var lastTokenOfNode = requireToken(firstSemanticTokenBefore(context, end), node);
start = firstTokenOfNode.start;

@@ -31,3 +31,3 @@ end = lastTokenOfNode.end;

exports["default"] = getLocation;
function firstSemanticTokenAfter(context, index, node) {
function firstSemanticTokenAfter(context, index) {
var tokenIndex = context.sourceTokens.indexOfTokenMatchingPredicate(function (token) {

@@ -38,5 +38,6 @@ return (token.start >= index &&

}, context.sourceTokens.indexOfTokenNearSourceIndex(index));
return tokenFromIndex(context, tokenIndex, node);
return tokenIndex === null ? null : context.sourceTokens.tokenAtIndex(tokenIndex);
}
function firstSemanticTokenBefore(context, index, node) {
exports.firstSemanticTokenAfter = firstSemanticTokenAfter;
function firstSemanticTokenBefore(context, index) {
var tokenIndex = context.sourceTokens.lastIndexOfTokenMatchingPredicate(function (token) {

@@ -47,9 +48,6 @@ return (token.end <= index &&

}, context.sourceTokens.indexOfTokenNearSourceIndex(index));
return tokenFromIndex(context, tokenIndex, node);
return tokenIndex === null ? null : context.sourceTokens.tokenAtIndex(tokenIndex);
}
function tokenFromIndex(context, tokenIndex, node) {
if (tokenIndex === null) {
throw new Error("unable to find token index for node: " + util_1.inspect(node));
}
var token = context.sourceTokens.tokenAtIndex(tokenIndex);
exports.firstSemanticTokenBefore = firstSemanticTokenBefore;
function requireToken(token, node) {
if (token === null) {

@@ -56,0 +54,0 @@ throw new Error("unable to find token for node: " + util_1.inspect(node));

{
"name": "decaffeinate-parser",
"description": "A better AST for CoffeeScript, inspired by CoffeeScriptRedux.",
"version": "22.4.0",
"version": "22.4.1",
"main": "dist/parser.js",

@@ -6,0 +6,0 @@ "module": "dist/parser.mjs",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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