Skip to content

Commit

Permalink
fix #65 - implement annonymous class arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ichiriac committed Mar 4, 2017
1 parent bf8b424 commit 7414f4e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
9 changes: 6 additions & 3 deletions dist/php-parser.js
Expand Up @@ -5987,8 +5987,11 @@ module.exports = {
if (this.token === this.tok.T_CLASS) {
var what = this.node('class');
// Annonymous class declaration
var propExtends = null, propImplements = null, body = null;
if (this.next().token == this.tok.T_EXTENDS) {
var propExtends = null, propImplements = null, body = null, args = [];
if (this.next().token === '(') {
args = this.read_function_argument_list();
}
if (this.token == this.tok.T_EXTENDS) {
propExtends = this.next().read_namespace_name();
}
if (this.token == this.tok.T_IMPLEMENTS) {
Expand All @@ -6004,7 +6007,7 @@ module.exports = {
,propImplements
,body
,[0, 0, 0]
), []
), args
);
} else {
// Already existing class
Expand Down
8 changes: 4 additions & 4 deletions dist/php-parser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/php-parser.min.js.map

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/parser/expr.js
Expand Up @@ -436,8 +436,11 @@ module.exports = {
if (this.token === this.tok.T_CLASS) {
var what = this.node('class');
// Annonymous class declaration
var propExtends = null, propImplements = null, body = null;
if (this.next().token == this.tok.T_EXTENDS) {
var propExtends = null, propImplements = null, body = null, args = [];
if (this.next().token === '(') {
args = this.read_function_argument_list();
}
if (this.token == this.tok.T_EXTENDS) {
propExtends = this.next().read_namespace_name();
}
if (this.token == this.tok.T_IMPLEMENTS) {
Expand All @@ -453,7 +456,7 @@ module.exports = {
,propImplements
,body
,[0, 0, 0]
), []
), args
);
} else {
// Already existing class
Expand Down

0 comments on commit 7414f4e

Please sign in to comment.