Skip to content

Commit

Permalink
Merge pull request #94 from bbtgp/dust
Browse files Browse the repository at this point in the history
Added suggested performance optimization
  • Loading branch information
ichiriac committed Nov 5, 2017
2 parents c353382 + 2bdc2e6 commit 2d8f68b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/parser/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module.exports = {
*/
function read_constant_declaration() {
var result = this.node('classconstant'), name = null, value = null;
if (this.is('IDENTIFIER') || this.expect(this.tok.T_STRING)) {
if (this.token === this.tok.T_STRING || this.is('IDENTIFIER')) {
name = this.text();
this.next();
}
Expand Down
15 changes: 6 additions & 9 deletions src/parser/variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,20 @@ module.exports = {
result = node(result, offset);
break;
case this.tok.T_DOUBLE_COLON:
var node = this.node('staticlookup'), offset;
this.next();

if(this.is('IDENTIFIER') || this.token === this.tok.T_STRING
|| this.token === this.tok.T_CLASS
) {
offset = this.node('constref');
if((this.next().token === this.tok.T_STRING || this.is('IDENTIFIER'))) {
var node = this.node('staticlookup');
var offset = this.node('constref');
var name = this.text();

this.next();
offset = offset(name);

if(this.token === this.tok.T_OBJECT_OPERATOR || this.token === this.tok.T_DOUBLE_COLON) {
this.error();
}
}

result = node(result, offset);
result = node(result, offset);
}
break;
case this.tok.T_OBJECT_OPERATOR:
var node = this.node('propertylookup');
Expand Down

0 comments on commit 2d8f68b

Please sign in to comment.