acorn
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -57,3 +57,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.acorn || (g.acorn = {})).walk = 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(_dereq_,module,exports){ | ||
function simple(node, visitors, base, state, override) { | ||
function simple(node, visitors, base, state) { | ||
if (!base) base = exports.base;(function c(node, st, override) { | ||
@@ -64,3 +64,3 @@ var type = override || node.type, | ||
if (found) found(node, st); | ||
})(node, state, override); | ||
})(node, state); | ||
} | ||
@@ -82,6 +82,6 @@ | ||
function recursive(node, state, funcs, base, override) { | ||
function recursive(node, state, funcs, base) { | ||
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) { | ||
visitor[override || node.type](node, st, c); | ||
})(node, state, override); | ||
})(node, state); | ||
} | ||
@@ -228,3 +228,3 @@ | ||
}; | ||
base.ThrowStatement = base.SpreadElement = function (node, st, c) { | ||
base.ThrowStatement = base.SpreadElement = base.RestElement = function (node, st, c) { | ||
return c(node.argument, st, "Expression"); | ||
@@ -234,6 +234,3 @@ }; | ||
c(node.block, st, "Statement"); | ||
if (node.handler) { | ||
c(node.handler.param, st, "Pattern"); | ||
c(node.handler.body, st, "ScopeBody"); | ||
} | ||
if (node.handler) c(node.handler.body, st, "ScopeBody"); | ||
if (node.finalizer) c(node.finalizer, st, "Statement"); | ||
@@ -267,3 +264,2 @@ }; | ||
var decl = node.declarations[i]; | ||
c(decl.id, st, "Pattern"); | ||
if (decl.init) c(decl.init, st, "Expression"); | ||
@@ -274,5 +270,3 @@ } | ||
base.Function = function (node, st, c) { | ||
for (var i = 0; i < node.params.length; i++) { | ||
c(node.params[i], st, "Pattern"); | ||
}c(node.body, st, "ScopeBody"); | ||
return c(node.body, st, "ScopeBody"); | ||
}; | ||
@@ -283,25 +277,5 @@ base.ScopeBody = function (node, st, c) { | ||
base.Pattern = function (node, st, c) { | ||
if (node.type == "Identifier") c(node, st, "VariablePattern");else if (node.type == "MemberExpression") c(node, st, "MemberPattern");else c(node, st); | ||
}; | ||
base.VariablePattern = ignore; | ||
base.MemberPattern = skipThrough; | ||
base.RestElement = function (node, st, c) { | ||
return c(node.argument, st, "Pattern"); | ||
}; | ||
base.ArrayPattern = function (node, st, c) { | ||
for (var i = 0; i < node.elements.length; ++i) { | ||
var elt = node.elements[i]; | ||
if (elt) c(elt, st, "Pattern"); | ||
} | ||
}; | ||
base.ObjectPattern = function (node, st, c) { | ||
for (var i = 0; i < node.properties.length; ++i) { | ||
c(node.properties[i].value, st, "Pattern"); | ||
} | ||
}; | ||
base.Expression = skipThrough; | ||
base.ThisExpression = base.Super = base.MetaProperty = ignore; | ||
base.ArrayExpression = function (node, st, c) { | ||
base.ArrayExpression = base.ArrayPattern = function (node, st, c) { | ||
for (var i = 0; i < node.elements.length; ++i) { | ||
@@ -312,3 +286,3 @@ var elt = node.elements[i]; | ||
}; | ||
base.ObjectExpression = function (node, st, c) { | ||
base.ObjectExpression = base.ObjectPattern = function (node, st, c) { | ||
for (var i = 0; i < node.properties.length; ++i) { | ||
@@ -327,10 +301,6 @@ c(node.properties[i], st); | ||
}; | ||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) { | ||
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = function (node, st, c) { | ||
c(node.left, st, "Expression"); | ||
c(node.right, st, "Expression"); | ||
}; | ||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { | ||
c(node.left, st, "Pattern"); | ||
c(node.right, st, "Expression"); | ||
}; | ||
base.ConditionalExpression = function (node, st, c) { | ||
@@ -352,3 +322,3 @@ c(node.test, st, "Expression"); | ||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { | ||
if (node.declaration) c(node.declaration, st); | ||
return c(node.declaration, st); | ||
}; | ||
@@ -367,6 +337,2 @@ base.ImportDeclaration = function (node, st, c) { | ||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { | ||
return c(node, st, "Class"); | ||
}; | ||
base.Class = function (node, st, c) { | ||
c(node.id, st, "Pattern"); | ||
if (node.superClass) c(node.superClass, st, "Expression"); | ||
@@ -373,0 +339,0 @@ for (var i = 0; i < node.body.body.length; i++) { |
@@ -6,3 +6,3 @@ { | ||
"main": "dist/acorn.js", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"engines": { | ||
@@ -27,8 +27,3 @@ "node": ">=0.4.0" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://raw.githubusercontent.com/marijnh/acorn/master/LICENSE" | ||
} | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
@@ -35,0 +30,0 @@ "test": "node test/run.js", |
@@ -40,3 +40,3 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. | ||
export const version = "1.1.0" | ||
export const version = "1.2.0" | ||
@@ -43,0 +43,0 @@ // The main exported interface (under `self.acorn` when in the |
@@ -19,3 +19,3 @@ // AST walker module for Mozilla Parser API compatible trees | ||
export function simple(node, visitors, base, state, override) { | ||
export function simple(node, visitors, base, state) { | ||
if (!base) base = exports.base | ||
@@ -26,3 +26,3 @@ ;(function c(node, st, override) { | ||
if (found) found(node, st) | ||
})(node, state, override) | ||
})(node, state) | ||
} | ||
@@ -51,7 +51,7 @@ | ||
// nodes). | ||
export function recursive(node, state, funcs, base, override) { | ||
export function recursive(node, state, funcs, base) { | ||
let visitor = funcs ? exports.make(funcs, base) : base | ||
;(function c(node, st, override) { | ||
visitor[override || node.type](node, st, c) | ||
})(node, state, override) | ||
})(node, state) | ||
} | ||
@@ -193,10 +193,7 @@ | ||
} | ||
base.ThrowStatement = base.SpreadElement = | ||
base.ThrowStatement = base.SpreadElement = base.RestElement = | ||
(node, st, c) => c(node.argument, st, "Expression") | ||
base.TryStatement = (node, st, c) => { | ||
c(node.block, st, "Statement") | ||
if (node.handler) { | ||
c(node.handler.param, st, "Pattern") | ||
c(node.handler.body, st, "ScopeBody") | ||
} | ||
if (node.handler) c(node.handler.body, st, "ScopeBody") | ||
if (node.finalizer) c(node.finalizer, st, "Statement") | ||
@@ -229,3 +226,2 @@ } | ||
let decl = node.declarations[i] | ||
c(decl.id, st, "Pattern") | ||
if (decl.init) c(decl.init, st, "Expression") | ||
@@ -235,34 +231,8 @@ } | ||
base.Function = (node, st, c) => { | ||
for (let i = 0; i < node.params.length; i++) | ||
c(node.params[i], st, "Pattern") | ||
c(node.body, st, "ScopeBody") | ||
} | ||
base.Function = (node, st, c) => c(node.body, st, "ScopeBody") | ||
base.ScopeBody = (node, st, c) => c(node, st, "Statement") | ||
base.Pattern = (node, st, c) => { | ||
if (node.type == "Identifier") | ||
c(node, st, "VariablePattern") | ||
else if (node.type == "MemberExpression") | ||
c(node, st, "MemberPattern") | ||
else | ||
c(node, st) | ||
} | ||
base.VariablePattern = ignore | ||
base.MemberPattern = skipThrough | ||
base.RestElement = (node, st, c) => c(node.argument, st, "Pattern") | ||
base.ArrayPattern = (node, st, c) => { | ||
for (let i = 0; i < node.elements.length; ++i) { | ||
let elt = node.elements[i] | ||
if (elt) c(elt, st, "Pattern") | ||
} | ||
} | ||
base.ObjectPattern = (node, st, c) => { | ||
for (let i = 0; i < node.properties.length; ++i) | ||
c(node.properties[i].value, st, "Pattern") | ||
} | ||
base.Expression = skipThrough | ||
base.ThisExpression = base.Super = base.MetaProperty = ignore | ||
base.ArrayExpression = (node, st, c) => { | ||
base.ArrayExpression = base.ArrayPattern = (node, st, c) => { | ||
for (let i = 0; i < node.elements.length; ++i) { | ||
@@ -273,3 +243,3 @@ let elt = node.elements[i] | ||
} | ||
base.ObjectExpression = (node, st, c) => { | ||
base.ObjectExpression = base.ObjectPattern = (node, st, c) => { | ||
for (let i = 0; i < node.properties.length; ++i) | ||
@@ -286,10 +256,6 @@ c(node.properties[i], st) | ||
} | ||
base.BinaryExpression = base.LogicalExpression = (node, st, c) => { | ||
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = (node, st, c) => { | ||
c(node.left, st, "Expression") | ||
c(node.right, st, "Expression") | ||
} | ||
base.AssignmentExpression = base.AssignmentPattern = (node, st, c) => { | ||
c(node.left, st, "Pattern") | ||
c(node.right, st, "Expression") | ||
} | ||
base.ConditionalExpression = (node, st, c) => { | ||
@@ -309,5 +275,3 @@ c(node.test, st, "Expression") | ||
} | ||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = (node, st, c) => { | ||
if (node.declaration) c(node.declaration, st) | ||
} | ||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = (node, st, c) => c(node.declaration, st) | ||
base.ImportDeclaration = (node, st, c) => { | ||
@@ -323,5 +287,3 @@ for (let i = 0; i < node.specifiers.length; i++) | ||
} | ||
base.ClassDeclaration = base.ClassExpression = (node, st, c) => c(node, st, "Class") | ||
base.Class = (node, st, c) => { | ||
c(node.id, st, "Pattern") | ||
base.ClassDeclaration = base.ClassExpression = (node, st, c) => { | ||
if (node.superClass) c(node.superClass, st, "Expression") | ||
@@ -328,0 +290,0 @@ for (let i = 0; i < node.body.body.length; i++) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
464551
11221