esprima-fb
Advanced tools
Comparing version 3001.1.0-dev-harmony-fb to 4001.1.0-dev-harmony-fb
@@ -10,6 +10,19 @@ { | ||
}, | ||
"version": "3001.0001.0000-dev-harmony-fb", | ||
"version": "4001.0001.0000-dev-harmony-fb", | ||
"files": [ | ||
"bin", | ||
"test/run.js", | ||
"test/runner.js", | ||
"test/test.js", | ||
"test/compat.js", | ||
"test/reflect.js", | ||
"esprima.js" | ||
], | ||
"engines": { | ||
"node": ">=0.4.0" | ||
}, | ||
"author": { | ||
"name": "Ariya Hidayat", | ||
"email": "ariya.hidayat@gmail.com" | ||
}, | ||
"maintainers": [{ | ||
@@ -24,2 +37,5 @@ "name": "Jeff Morrison", | ||
}, | ||
"bugs": { | ||
"url": "http://issues.esprima.org" | ||
}, | ||
"licenses": [{ | ||
@@ -40,3 +56,3 @@ "type": "BSD", | ||
"test": "npm run-script lint && node test/run.js && npm run-script coverage && npm run-script complexity", | ||
"lint": "node tools/check-version.js && node_modules/eslint/bin/eslint.js esprima.js && node_modules/jslint/bin/jslint.js esprima.js", | ||
"lint": "node tools/check-version.js && node node_modules/eslint/bin/eslint.js esprima.js && node node_modules/jslint/bin/jslint.js esprima.js", | ||
"coverage": "npm run-script analyze-coverage && npm run-script check-coverage", | ||
@@ -43,0 +59,0 @@ "analyze-coverage": "node node_modules/istanbul/lib/cli.js cover test/runner.js", |
@@ -90,3 +90,3 @@ // This is modified from Mozilla Reflect.parse test suite (the file is located | ||
function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg }) } | ||
function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }) } | ||
function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }) } | ||
@@ -93,0 +93,0 @@ function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }) } |
@@ -74,2 +74,24 @@ /* | ||
function needLoc(syntax) { | ||
var need = true; | ||
if (typeof syntax.tokens !== 'undefined' && syntax.tokens.length > 0) { | ||
need = (typeof syntax.tokens[0].loc !== 'undefined'); | ||
} | ||
if (typeof syntax.comments !== 'undefined' && syntax.comments.length > 0) { | ||
need = (typeof syntax.comments[0].loc !== 'undefined'); | ||
} | ||
return need; | ||
} | ||
function needRange(syntax) { | ||
var need = true; | ||
if (typeof syntax.tokens !== 'undefined' && syntax.tokens.length > 0) { | ||
need = (typeof syntax.tokens[0].range !== 'undefined'); | ||
} | ||
if (typeof syntax.comments !== 'undefined' && syntax.comments.length > 0) { | ||
need = (typeof syntax.comments[0].range !== 'undefined'); | ||
} | ||
return need; | ||
} | ||
function testParse(esprima, code, syntax) { | ||
@@ -84,4 +106,4 @@ 'use strict'; | ||
comment: (typeof syntax.comments !== 'undefined'), | ||
range: true, | ||
loc: true, | ||
range: needRange(syntax), | ||
loc: needLoc(syntax), | ||
tokens: (typeof syntax.tokens !== 'undefined'), | ||
@@ -93,16 +115,2 @@ raw: true, | ||
if (typeof syntax.tokens !== 'undefined') { | ||
if (syntax.tokens.length > 0) { | ||
options.range = (typeof syntax.tokens[0].range !== 'undefined'); | ||
options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); | ||
} | ||
} | ||
if (typeof syntax.comments !== 'undefined') { | ||
if (syntax.comments.length > 0) { | ||
options.range = (typeof syntax.comments[0].range !== 'undefined'); | ||
options.loc = (typeof syntax.comments[0].loc !== 'undefined'); | ||
} | ||
} | ||
if (options.loc) { | ||
@@ -170,2 +178,25 @@ options.source = syntax.loc.source; | ||
function mustHaveLocRange(testName, node, needLoc, needRange, stack) { | ||
var error; | ||
if (node.hasOwnProperty('type')) { | ||
if (needLoc && !node.loc) { | ||
error = "doesn't have 'loc' property"; | ||
} | ||
if (needRange && !node.range) { | ||
error = "doesn't have 'range' property"; | ||
} | ||
if (error) { | ||
stack = stack.length ? ' at [' + stack.join('][') + ']' : ''; | ||
throw new Error("Test '" + testName + "'" + stack + " (type = " + node.type + ") " + error); | ||
} | ||
} | ||
for (i in node) { | ||
if (node.hasOwnProperty(i) && node[i] !== null && typeof node[i] === 'object') { | ||
stack.push(i); | ||
mustHaveLocRange(testName, node[i], needLoc, needRange, stack); | ||
stack.pop(); | ||
} | ||
} | ||
} | ||
function testTokenize(esprima, code, tokens) { | ||
@@ -415,2 +446,5 @@ 'use strict'; | ||
expected = testFixture[category][source]; | ||
if (!expected.hasOwnProperty('lineNumber') && !expected.hasOwnProperty('result')) { | ||
mustHaveLocRange(source, expected, needLoc(expected), needRange(expected), []); | ||
} | ||
try { | ||
@@ -417,0 +451,0 @@ runTest(esprima, source, expected); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
2
5
1010838
10
1
28109