lc2-compiler
Advanced tools
Comparing version 2.1.4 to 2.1.5
@@ -112,3 +112,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LCP = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
getPosInfo, empowerErrMsg, Lc2SyntaxError, | ||
mapCharCount, getLineNum | ||
mapCharCount | ||
} = require('./locutil'); | ||
@@ -139,2 +139,3 @@ var tokentype = require('./tokentype'); | ||
this.charCountList = mapCharCount(this.input); | ||
this.lastLineOffset = 0; | ||
@@ -1221,2 +1222,15 @@ this.loadPlugins(options.pluginList); | ||
getLineNum() { | ||
var { charCountList, lastLineOffset, start } = this; | ||
var len = charCountList.length; | ||
for (var i = lastLineOffset; i < len; i++) { | ||
if (charCountList[i] >= start) { | ||
this.lastLineOffset = i; | ||
return i + 1; | ||
} | ||
} | ||
return len; | ||
} | ||
// # AST node handling | ||
@@ -1227,3 +1241,3 @@ // Start an AST node, attaching a start offset. | ||
POSITION: { | ||
LINE: getLineNum(this.charCountList, this.start), | ||
LINE: this.getLineNum(this.charCountList, this.start), | ||
start: this.start, | ||
@@ -1241,3 +1255,3 @@ end: 0, | ||
POSITION: { | ||
LINE: getLineNum(this.charCountList, this.start), | ||
LINE: this.getLineNum(this.charCountList, this.start), | ||
start, | ||
@@ -1637,3 +1651,3 @@ end: 0, | ||
checkPropClash(prop, propHash) { | ||
var key = String(prop.BODY.IDENTIFIER); | ||
var key = prop.BODY.IDENTIFIER; | ||
var hashname = '$' + key; | ||
@@ -1644,5 +1658,3 @@ var other = propHash[hashname]; | ||
} else { | ||
propHash[hashname] = { | ||
init: true | ||
}; | ||
propHash[hashname] = true; | ||
} | ||
@@ -1734,13 +1746,2 @@ } | ||
exports.getLineNum = function (charCountList, offset) { | ||
var len = charCountList.length; | ||
for (var i = 0; i < len; i++) { | ||
if (charCountList[i] >= offset) { | ||
return i + 1; | ||
} | ||
} | ||
return len; | ||
}; | ||
// These functions 'power up' the error message | ||
@@ -1747,0 +1748,0 @@ // by draw an arrow point to the error position |
{ | ||
"name": "lc2-compiler", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "lemoncase2 parser", | ||
@@ -10,5 +10,5 @@ "main": "dist/bundle.js", | ||
"build-core": "browserify index.js -t babelify -s LCP --outfile dist/bundle.js --no-bundle-external", | ||
"build-browser": "browserify browser.js -t babelify -s LCP --outfile dist/common.bundle.js", | ||
"build-browser": "browserify browser.js -t babelify -s LCP --outfile dist/browser.js", | ||
"build-id": "browserify lib/identifier.js -t babelify -s LCI --outfile dist/identifier.js", | ||
"build": "npm run build-core && npm run build-id" | ||
"build": "npm run build-core && npm run build-browser && npm run build-id" | ||
}, | ||
@@ -44,5 +44,6 @@ "typings": "index.d.ts", | ||
"ignores": [ | ||
"test/debug-vm/*.js" | ||
"test/**/*.js", | ||
"dist/*.js" | ||
] | ||
} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
129723
7
3683
11
1