Skip to content

Commit fdd8c15

Browse files
committed
glayzzle#401 - add an extension point
1 parent 2611ab6 commit fdd8c15

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/parser/expr.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,22 +413,10 @@ module.exports = {
413413
switch (this.token) {
414414
case "=": {
415415
if (isConst) this.error("VARIABLE");
416-
let right;
417416
if (this.next().token == "&") {
418-
this.next();
419-
if (this.token === this.tok.T_NEW) {
420-
if (this.version >= 700) {
421-
this.error();
422-
}
423-
right = this.read_new_expr();
424-
} else {
425-
right = this.read_variable(false, false);
426-
}
427-
428-
return result("assignref", expr, right);
417+
return this.read_assignref(result, expr);
429418
}
430-
right = this.read_expr();
431-
return result("assign", expr, right, "=");
419+
return result("assign", expr, this.read_expr(), "=");
432420
}
433421

434422
// operations :
@@ -520,6 +508,25 @@ module.exports = {
520508
return expr;
521509
},
522510

511+
/**
512+
* Reads assignment
513+
* @param {*} left
514+
*/
515+
read_assignref: function(result, left) {
516+
this.next();
517+
let right;
518+
if (this.token === this.tok.T_NEW) {
519+
if (this.version >= 700) {
520+
this.error();
521+
}
522+
right = this.read_new_expr();
523+
} else {
524+
right = this.read_variable(false, false);
525+
}
526+
527+
return result("assignref", left, right);
528+
},
529+
523530
/**
524531
*
525532
* inline_function:

0 commit comments

Comments
 (0)