Skip to content

Commit 68bbcab

Browse files
committed
1 parent 1677802 commit 68bbcab

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed

dist/php-parser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! php-parser - BSD3 License - 2018-04-11 */
1+
/*! php-parser - BSD3 License - 2018-04-13 */
22

33
require=(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(require,module,exports){
44
/*!
@@ -6010,7 +6010,7 @@ module.exports = {
60106010
* ```
60116011
*/
60126012
read_assignment_list: function read_assignment_list() {
6013-
return this.read_list(this.read_assignment_list_element, ",");
6013+
return this.read_list(this.read_assignment_list_element, ",", true);
60146014
},
60156015

60166016
/**
@@ -7606,7 +7606,7 @@ module.exports = {
76067606
var result = [];
76077607

76087608
if (this.token == separator) {
7609-
if (preserveFirstSeparator) result.push("");
7609+
if (preserveFirstSeparator) result.push(null);
76107610
this.next();
76117611
}
76127612

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.

dist/php-parser.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parser/expr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ module.exports = {
492492
* ```
493493
*/
494494
read_assignment_list: function() {
495-
return this.read_list(this.read_assignment_list_element, ",");
495+
return this.read_list(this.read_assignment_list_element, ",", true);
496496
},
497497

498498
/**

src/parser/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
const result = [];
3535

3636
if (this.token == separator) {
37-
if (preserveFirstSeparator) result.push("");
37+
if (preserveFirstSeparator) result.push(null);
3838
this.next();
3939
}
4040

test/exprTests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,20 @@ describe("Test expressions", function() {
228228
// @todo
229229
});
230230

231+
it("fix #137", function() {
232+
var ast = parser.parseEval(
233+
"list(,,$a,,$b) = [null, 1, null, 2];",
234+
{
235+
ast: {
236+
withPositions: true
237+
}
238+
}
239+
);
240+
const list = ast.children[0].left;
241+
list.arguments.length.should.be.exactly(5);
242+
list.arguments[2].name.should.be.exactly('a');
243+
});
244+
231245
it("test incr/decr", function() {
232246
var ast = parser.parseEval(
233247
["$i++;", "$i--;", "++$i;", "--$i;"].join("\n"),

0 commit comments

Comments
 (0)