Skip to content

Commit 4c87f29

Browse files
committed
fix positions on assign nodes
1 parent 91010c0 commit 4c87f29

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/parser/expr.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@ module.exports = {
337337
// SCALAR | VARIABLE
338338
var expr;
339339
if (this.is('VARIABLE')) {
340+
var result = this.node();
340341
expr = this.read_variable(false, false, false);
341342
// VARIABLES SPECIFIC OPERATIONS
342343
switch(this.token) {
343344
case '=':
344-
var result = this.node('assign');
345345
var right;
346346
if (this.next().token == '&') {
347347
if (this.next().token === this.tok.T_NEW) {
@@ -352,53 +352,51 @@ module.exports = {
352352
} else {
353353
right = this.read_expr();
354354
}
355-
return result(expr, right, '=');
355+
return result('assign', expr, right, '=');
356356

357357
// operations :
358358
case this.tok.T_PLUS_EQUAL:
359-
return this.node('assign')(expr, this.next().read_expr(), '+=');
359+
return result('assign', expr, this.next().read_expr(), '+=');
360360

361361
case this.tok.T_MINUS_EQUAL:
362-
return this.node('assign')(expr, this.next().read_expr(), '-=');
362+
return result('assign', expr, this.next().read_expr(), '-=');
363363

364364
case this.tok.T_MUL_EQUAL:
365-
return this.node('assign')(expr, this.next().read_expr(), '*=');
365+
return result('assign', expr, this.next().read_expr(), '*=');
366366

367367
case this.tok.T_POW_EQUAL:
368-
return this.node('assign')(expr, this.next().read_expr(), '**=');
368+
return result('assign', expr, this.next().read_expr(), '**=');
369369

370370
case this.tok.T_DIV_EQUAL:
371-
return this.node('assign')(expr, this.next().read_expr(), '/=');
371+
return result('assign', expr, this.next().read_expr(), '/=');
372372

373373
case this.tok.T_CONCAT_EQUAL:
374-
return this.node('assign')(expr, this.next().read_expr(), '.=');
374+
return result('assign', expr, this.next().read_expr(), '.=');
375375

376376
case this.tok.T_MOD_EQUAL:
377-
return this.node('assign')(expr, this.next().read_expr(), '%=');
377+
return result('assign', expr, this.next().read_expr(), '%=');
378378

379379
case this.tok.T_AND_EQUAL:
380-
return this.node('assign')(expr, this.next().read_expr(), '&=');
380+
return result('assign', expr, this.next().read_expr(), '&=');
381381

382382
case this.tok.T_OR_EQUAL:
383-
return this.node('assign')(expr, this.next().read_expr(), '|=');
383+
return result('assign', expr, this.next().read_expr(), '|=');
384384

385385
case this.tok.T_XOR_EQUAL:
386-
return this.node('assign')(expr, this.next().read_expr(), '^=');
386+
return result('assign', expr, this.next().read_expr(), '^=');
387387

388388
case this.tok.T_SL_EQUAL:
389-
return this.node('assign')(expr, this.next().read_expr(), '<<=');
389+
return result('assign', expr, this.next().read_expr(), '<<=');
390390

391391
case this.tok.T_SR_EQUAL:
392-
return this.node('assign')(expr, this.next().read_expr(), '>>=');
392+
return result('assign',expr, this.next().read_expr(), '>>=');
393393

394394
case this.tok.T_INC:
395-
var result = this.node('post');
396395
this.next();
397-
return result('+', expr);
396+
return result('post', '+', expr);
398397
case this.tok.T_DEC:
399-
var result = this.node('post');
400398
this.next();
401-
return result('-', expr);
399+
return result('post', '-', expr);
402400
}
403401
} else if (this.is('SCALAR')) {
404402
expr = this.read_scalar();
@@ -416,7 +414,7 @@ module.exports = {
416414
}
417415
}
418416
} else {
419-
expr = this.error('EXPR');
417+
this.error('EXPR');
420418
this.next();
421419
}
422420

0 commit comments

Comments
 (0)