acorn
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -258,7 +258,12 @@ (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){ | ||
c(node.params[i], st, "Pattern"); | ||
}c(node.body, st, "ScopeBody"); | ||
}c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody"); | ||
}; | ||
// FIXME drop these node types in next major version | ||
// (They are awkward, and in ES6 every block can be a scope.) | ||
base.ScopeBody = function (node, st, c) { | ||
return c(node, st, "Statement"); | ||
}; | ||
base.ScopeExpression = function (node, st, c) { | ||
return c(node, st, "Expression"); | ||
}; | ||
@@ -265,0 +270,0 @@ base.Pattern = function (node, st, c) { |
@@ -6,3 +6,3 @@ { | ||
"main": "dist/acorn.js", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"engines": { | ||
@@ -9,0 +9,0 @@ "node": ">=0.4.0" |
@@ -40,3 +40,3 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. | ||
export const version = "2.1.0" | ||
export const version = "2.2.0" | ||
@@ -43,0 +43,0 @@ // The main exported interface (under `self.acorn` when in the |
@@ -153,3 +153,2 @@ import {types as tt} from "./tokentype" | ||
let node = this.startNodeAt(startPos, startLoc) | ||
node.operator = "=" | ||
node.left = left | ||
@@ -156,0 +155,0 @@ node.right = this.parseMaybeAssign() |
@@ -17,2 +17,7 @@ import {reservedWords, keywords} from "./identifier" | ||
// Used to signal to callers of `readWord1` whether the word | ||
// contained any escape sequences. This is needed because words with | ||
// escape sequences must not be interpreted as keywords. | ||
this.containsEsc = false; | ||
// Load plugins | ||
@@ -19,0 +24,0 @@ this.loadPlugins(this.options.plugins) |
@@ -568,3 +568,2 @@ import {types as tt} from "./tokentype" | ||
node.source = this.parseExprAtom() | ||
node.kind = "" | ||
} else { | ||
@@ -571,0 +570,0 @@ node.specifiers = this.parseImportSpecifiers() |
@@ -639,9 +639,3 @@ import {isIdentifierStart, isIdentifierChar} from "./identifier" | ||
// Used to signal to callers of `readWord1` whether the word | ||
// contained any escape sequences. This is needed because words with | ||
// escape sequences must not be interpreted as keywords. | ||
var containsEsc | ||
// Read an identifier, and return it as a string. Sets `containsEsc` | ||
// Read an identifier, and return it as a string. Sets `this.containsEsc` | ||
// to whether the word contained a '\u' escape. | ||
@@ -653,3 +647,3 @@ // | ||
pp.readWord1 = function() { | ||
containsEsc = false | ||
this.containsEsc = false | ||
let word = "", first = true, chunkStart = this.pos | ||
@@ -662,3 +656,3 @@ let astral = this.options.ecmaVersion >= 6 | ||
} else if (ch === 92) { // "\" | ||
containsEsc = true | ||
this.containsEsc = true | ||
word += this.input.slice(chunkStart, this.pos) | ||
@@ -688,5 +682,5 @@ let escStart = this.pos | ||
let type = tt.name | ||
if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word)) | ||
if ((this.options.ecmaVersion >= 6 || !this.containsEsc) && this.isKeyword(word)) | ||
type = keywordTypes[word] | ||
return this.finishToken(type, word) | ||
} |
@@ -233,5 +233,8 @@ // AST walker module for Mozilla Parser API compatible trees | ||
c(node.params[i], st, "Pattern") | ||
c(node.body, st, "ScopeBody") | ||
c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody") | ||
} | ||
// FIXME drop these node types in next major version | ||
// (They are awkward, and in ES6 every block can be a scope.) | ||
base.ScopeBody = (node, st, c) => c(node, st, "Statement") | ||
base.ScopeExpression = (node, st, c) => c(node, st, "Expression") | ||
@@ -238,0 +241,0 @@ base.Pattern = (node, st, c) => { |
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
482688
11371