Socket
Socket
Sign inDemoInstall

acorn

Package Overview
Dependencies
0
Maintainers
2
Versions
131
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.0.4

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 3.0.4 (2016-02-25)
### Fixes
Allow update expressions as left-hand-side of the ES7 exponential
operator.
## 3.0.2 (2016-02-10)

@@ -2,0 +9,0 @@

45

dist/acorn_loose.js

@@ -98,3 +98,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 = {})).loose = 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){

line = this.curLineStart;
return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line);
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line);
};

@@ -115,3 +115,3 @@

var rightStart = this.storeCurrentPos();
node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line);
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line);
}

@@ -125,34 +125,37 @@ this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");

lp.parseMaybeUnary = function (noIn) {
lp.parseMaybeUnary = function (sawUnary) {
var start = this.storeCurrentPos(),
expr = undefined;
if (this.tok.type.prefix) {
var node = this.startNode(),
update = this.tok.type === _.tokTypes.incDec;
if (!update) sawUnary = true;
node.operator = this.tok.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(noIn);
node.argument = this.parseMaybeUnary(true);
if (update) node.argument = this.checkLVal(node.argument);
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (this.tok.type === _.tokTypes.ellipsis) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(noIn);
return this.finishNode(node, "SpreadElement");
node.argument = this.parseMaybeUnary(sawUnary);
expr = this.finishNode(node, "SpreadElement");
} else {
expr = this.parseExprSubscripts();
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.prefix = false;
node.argument = this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
}
var start = this.storeCurrentPos();
var expr = this.parseExprSubscripts();
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.prefix = false;
node.argument = this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
if (this.eat(_.tokTypes.starstar)) {
if (!sawUnary && this.eat(_.tokTypes.starstar)) {
var node = this.startNodeAt(start);
node.operator = "**";
node.left = expr;
node.right = this.parseMaybeUnary(noIn);
node.right = this.parseMaybeUnary(false);
return this.finishNode(node, "BinaryExpression");

@@ -371,3 +374,3 @@ }

prop.value = this.parseMethod(isGenerator);
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") && (this.tok.type != _.tokTypes.comma && this.tok.type != _.tokTypes.braceR)) {
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") && this.tok.type != _.tokTypes.comma && this.tok.type != _.tokTypes.braceR) {
prop.kind = prop.key.name;

@@ -1055,3 +1058,3 @@ this.parsePropertyName(prop);

}
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && (this.tok.type != _.tokTypes.parenL && this.tok.type != _.tokTypes.braceL)) {
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && this.tok.type != _.tokTypes.parenL && this.tok.type != _.tokTypes.braceL) {
method["static"] = true;

@@ -1058,0 +1061,0 @@ isGenerator = this.eat(_.tokTypes.star);

@@ -6,3 +6,3 @@ {

"main": "dist/acorn.js",
"version": "3.0.2",
"version": "3.0.4",
"engines": {

@@ -9,0 +9,0 @@ "node": ">=0.4.0"

@@ -66,3 +66,3 @@ # Acorn

either 3, 5, 6, or 7. This influences support for strict mode, the set
of reserved words, and support for new syntax features. Default is 5.
of reserved words, and support for new syntax features. Default is 6.

@@ -69,0 +69,0 @@ - **sourceType**: Indicate the mode the code should be parsed in. Can be

@@ -180,4 +180,4 @@ // A recursive descent parser operates by defining functions for all

pp.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
let startPos = this.start, startLoc = this.startLoc, expr
if (this.type.prefix) {
sawUnary = true
let node = this.startNode(), update = this.type === tt.incDec

@@ -193,17 +193,17 @@ node.operator = this.value

this.raiseRecoverable(node.start, "Deleting local variable in strict mode")
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
else sawUnary = true
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
} else {
expr = this.parseExprSubscripts(refDestructuringErrors)
if (this.checkExpressionErrors(refDestructuringErrors)) return expr
while (this.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(startPos, startLoc)
node.operator = this.value
node.prefix = false
node.argument = expr
this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}
}
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseExprSubscripts(refDestructuringErrors)
if (this.checkExpressionErrors(refDestructuringErrors)) return expr
while (this.type.postfix && !this.canInsertSemicolon()) {
sawUnary = true
let node = this.startNodeAt(startPos, startLoc)
node.operator = this.value
node.prefix = false
node.argument = expr
this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}

@@ -210,0 +210,0 @@ if (!sawUnary && this.eat(tt.starstar))

@@ -39,3 +39,3 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript.

export const version = "3.0.2"
export const version = "3.0.4"

@@ -42,0 +42,0 @@ // The main exported interface (under `self.acorn` when in the

@@ -87,3 +87,3 @@ import {LooseParser} from "./state"

let indent = this.curIndent, line = this.curLineStart
return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line)
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line)
}

@@ -104,3 +104,3 @@

let rightStart = this.storeCurrentPos()
node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line)
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line)
}

@@ -114,33 +114,35 @@ this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression")

lp.parseMaybeUnary = function(noIn) {
lp.parseMaybeUnary = function(sawUnary) {
let start = this.storeCurrentPos(), expr
if (this.tok.type.prefix) {
let node = this.startNode(), update = this.tok.type === tt.incDec
if (!update) sawUnary = true
node.operator = this.tok.value
node.prefix = true
this.next()
node.argument = this.parseMaybeUnary(noIn)
node.argument = this.parseMaybeUnary(true)
if (update) node.argument = this.checkLVal(node.argument)
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
} else if (this.tok.type === tt.ellipsis) {
let node = this.startNode()
this.next()
node.argument = this.parseMaybeUnary(noIn)
return this.finishNode(node, "SpreadElement")
node.argument = this.parseMaybeUnary(sawUnary)
expr = this.finishNode(node, "SpreadElement")
} else {
expr = this.parseExprSubscripts()
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(start)
node.operator = this.tok.value
node.prefix = false
node.argument = this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}
}
let start = this.storeCurrentPos()
let expr = this.parseExprSubscripts()
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(start)
node.operator = this.tok.value
node.prefix = false
node.argument = this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}
if (this.eat(tt.starstar)) {
if (!sawUnary && this.eat(tt.starstar)) {
let node = this.startNodeAt(start)
node.operator = "**"
node.left = expr
node.right = this.parseMaybeUnary(noIn)
node.right = this.parseMaybeUnary(false)
return this.finishNode(node, "BinaryExpression")

@@ -147,0 +149,0 @@ }

@@ -292,4 +292,3 @@ import {isIdentifierStart, isIdentifierChar} from "./identifier"

}
if (next === 61)
size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2
if (next === 61) size = 2
return this.finishOp(tt.relational, size)

@@ -296,0 +295,0 @@ }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc