Skip to content

Commit 5c6fe91

Browse files
committed
release 3.0.2
1 parent ba23f4c commit 5c6fe91

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

dist/php-parser.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Package: php-parser
44
* Parse PHP code from JS and returns its AST
5-
* Build: 6af20f43d0d6855ac0e0 - 2020-4-24
5+
* Build: 6828de23c173b08ca739 - 2020-10-4
66
* Copyright (C) 2020 Glayzzle (BSD-3-Clause)
77
* @authors https://github.com/glayzzle/php-parser/graphs/contributors
88
* @url http://glayzzle.com
@@ -3650,7 +3650,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
36503650

36513651
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
36523652

3653-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3653+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
36543654

36553655
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
36563656

@@ -4741,7 +4741,7 @@ module.exports = {
47414741

47424742
if (expr.kind === "array" && expr.shortForm && this.token === "=") {
47434743
// list assign
4744-
var list = this.node("list")(expr.items, true);
4744+
var list = this.convertToList(expr);
47454745
if (expr.loc) list.loc = expr.loc;
47464746
var right = this.next().read_expr();
47474747
return result("assign", list, right, "=");
@@ -4761,6 +4761,26 @@ module.exports = {
47614761
return expr;
47624762
},
47634763

4764+
/**
4765+
* Recursively convert nested array to nested list.
4766+
*/
4767+
convertToList: function convertToList(array) {
4768+
var _this = this;
4769+
4770+
var convertedItems = array.items.map(function (entry) {
4771+
if (entry.value && entry.value.kind === "array" && entry.value.shortForm) {
4772+
entry.value = _this.convertToList(entry.value);
4773+
}
4774+
4775+
return entry;
4776+
});
4777+
var node = this.node("list")(convertedItems, true);
4778+
if (array.loc) node.loc = array.loc;
4779+
if (array.leadingComments) node.leadingComments = array.leadingComments;
4780+
if (array.trailingComments) node.trailingComments = array.trailingComments;
4781+
return node;
4782+
},
4783+
47644784
/**
47654785
* Reads assignment
47664786
* @param {*} left
@@ -8024,7 +8044,7 @@ AST.prototype.resolvePrecedence = function (result, parser) {
80248044
lLevel = AST.precedence[result.type];
80258045
rLevel = AST.precedence[result.right.type];
80268046

8027-
if (lLevel && rLevel && rLevel <= lLevel && !this.isRightAssociative(result.type)) {
8047+
if (lLevel && rLevel && rLevel <= lLevel && (result.type !== result.right.type || !this.isRightAssociative(result.type))) {
80288048
// https://github.com/glayzzle/php-parser/issues/79
80298049
// shift precedence
80308050
buffer = result.right;

dist/php-parser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "php-parser",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Parse PHP code from JS and returns its AST",
55
"main": "src/index.js",
66
"browser": "dist/php-parser.js",

0 commit comments

Comments
 (0)