Skip to content

Commit 7414f4e

Browse files
committed
fix glayzzle#65 - implement annonymous class arguments
1 parent bf8b424 commit 7414f4e

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

dist/php-parser.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5987,8 +5987,11 @@ module.exports = {
59875987
if (this.token === this.tok.T_CLASS) {
59885988
var what = this.node('class');
59895989
// Annonymous class declaration
5990-
var propExtends = null, propImplements = null, body = null;
5991-
if (this.next().token == this.tok.T_EXTENDS) {
5990+
var propExtends = null, propImplements = null, body = null, args = [];
5991+
if (this.next().token === '(') {
5992+
args = this.read_function_argument_list();
5993+
}
5994+
if (this.token == this.tok.T_EXTENDS) {
59925995
propExtends = this.next().read_namespace_name();
59935996
}
59945997
if (this.token == this.tok.T_IMPLEMENTS) {
@@ -6004,7 +6007,7 @@ module.exports = {
60046007
,propImplements
60056008
,body
60066009
,[0, 0, 0]
6007-
), []
6010+
), args
60086011
);
60096012
} else {
60106013
// Already existing class

dist/php-parser.min.js

Lines changed: 4 additions & 4 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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,11 @@ module.exports = {
436436
if (this.token === this.tok.T_CLASS) {
437437
var what = this.node('class');
438438
// Annonymous class declaration
439-
var propExtends = null, propImplements = null, body = null;
440-
if (this.next().token == this.tok.T_EXTENDS) {
439+
var propExtends = null, propImplements = null, body = null, args = [];
440+
if (this.next().token === '(') {
441+
args = this.read_function_argument_list();
442+
}
443+
if (this.token == this.tok.T_EXTENDS) {
441444
propExtends = this.next().read_namespace_name();
442445
}
443446
if (this.token == this.tok.T_IMPLEMENTS) {
@@ -453,7 +456,7 @@ module.exports = {
453456
,propImplements
454457
,body
455458
,[0, 0, 0]
456-
), []
459+
), args
457460
);
458461
} else {
459462
// Already existing class

0 commit comments

Comments
 (0)