homunculus
Advanced tools
Comparing version
{ | ||
"name": "homunculus", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "A lexer&parser by Javascript", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -259,3 +259,3 @@ var IParser = require('../Parser'); | ||
}, | ||
stmtlitem: function(yYield) { | ||
stmtlitem: function(yYield, isConstructor) { | ||
if(['function', 'class', 'let', 'const'].indexOf(this.look.content()) > -1) { | ||
@@ -265,3 +265,3 @@ return this.decl(yYield); | ||
else { | ||
return this.stmt(yYield); | ||
return this.stmt(yYield, isConstructor); | ||
} | ||
@@ -296,3 +296,3 @@ }, | ||
}, | ||
stmt: function(yYield) { | ||
stmt: function(yYield, isConstructor) { | ||
if(!this.look) { | ||
@@ -339,3 +339,3 @@ this.error(); | ||
else { | ||
return this.exprstmt(yYield); | ||
return this.exprstmt(yYield, isConstructor); | ||
} | ||
@@ -345,8 +345,8 @@ } | ||
} | ||
return this.exprstmt(yYield); | ||
return this.exprstmt(yYield, isConstructor); | ||
} | ||
}, | ||
exprstmt: function(yYield) { | ||
exprstmt: function(yYield, isConstructor) { | ||
var node = new Node(Node.EXPRSTMT); | ||
node.add(this.expr(null, null, yYield), this.match(';')); | ||
node.add(this.expr(null, null, yYield, isConstructor), this.match(';')); | ||
return node; | ||
@@ -1091,6 +1091,6 @@ }, | ||
}, | ||
fnbody: function(yYield) { | ||
fnbody: function(yYield, isConstructor) { | ||
var node = new Node(Node.FNBODY); | ||
while(this.look && this.look.content() != '}') { | ||
node.add(this.stmtlitem(yYield)); | ||
node.add(this.stmtlitem(yYield, isConstructor)); | ||
} | ||
@@ -1200,2 +1200,3 @@ return node; | ||
else { | ||
var isConstructor = this.look.type() == Token.ID && this.look.content() == 'constructor'; | ||
node.add( | ||
@@ -1207,3 +1208,3 @@ this.proptname(noIn, noOf), | ||
this.match('{'), | ||
this.fnbody(), | ||
this.fnbody(false, isConstructor), | ||
this.match('}') | ||
@@ -1228,5 +1229,5 @@ ); | ||
}, | ||
expr: function(noIn, noOf, yYield) { | ||
expr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.EXPR), | ||
assignexpr = this.assignexpr(noIn, noOf, yYield); | ||
assignexpr = this.assignexpr(noIn, noOf, yYield, isConstructor); | ||
//LL2区分,后的...是否为cpeapl | ||
@@ -1255,3 +1256,3 @@ if(this.look && this.look.content() == ',') { | ||
} | ||
node.add(this.match(), this.assignexpr(noIn, noOf, yYield)); | ||
node.add(this.match(), this.assignexpr(noIn, noOf, yYield, isConstructor)); | ||
} | ||
@@ -1272,3 +1273,3 @@ } | ||
}, | ||
assignexpr: function(noIn, noOf, yYield) { | ||
assignexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.ASSIGNEXPR); | ||
@@ -1284,3 +1285,3 @@ if(!this.look) { | ||
} | ||
var cndt = this.cndtexpr(noIn, noOf, yYield); | ||
var cndt = this.cndtexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look | ||
@@ -1319,3 +1320,3 @@ && this.look.content() == '=>' | ||
&& !NOASSIGN.hasOwnProperty(cndt.name())) { | ||
node.add(cndt, this.match(), this.assignexpr(noIn, noOf, yYield)); | ||
node.add(cndt, this.match(), this.assignexpr(noIn, noOf, yYield, isConstructor)); | ||
} | ||
@@ -1386,5 +1387,5 @@ else { | ||
}, | ||
cndtexpr: function(noIn, noOf, yYield) { | ||
cndtexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.CNDTEXPR), | ||
logorexpr = this.logorexpr(noIn, noOf, yYield); | ||
logorexpr = this.logorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '?') { | ||
@@ -1394,5 +1395,5 @@ node.add( | ||
this.match(), | ||
this.assignexpr(noIn, noOf, yYield), | ||
this.assignexpr(noIn, noOf, yYield, isConstructor), | ||
this.match(':'), | ||
this.assignexpr(noIn, noOf, yYield) | ||
this.assignexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1405,5 +1406,5 @@ } | ||
}, | ||
logorexpr: function(noIn, noOf, yYield) { | ||
logorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.LOGOREXPR), | ||
logandexpr = this.logandexpr(noIn, noOf, yYield); | ||
logandexpr = this.logandexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '||') { | ||
@@ -1414,3 +1415,3 @@ node.add(logandexpr); | ||
this.match(), | ||
this.logandexpr(noIn, noOf, yYield) | ||
this.logandexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1424,5 +1425,5 @@ } | ||
}, | ||
logandexpr: function(noIn, noOf, yYield) { | ||
logandexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.LOGANDEXPR), | ||
bitorexpr = this.bitorexpr(noIn, noOf); | ||
bitorexpr = this.bitorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '&&') { | ||
@@ -1433,3 +1434,3 @@ node.add(bitorexpr); | ||
this.match(), | ||
this.bitorexpr(noIn, noOf, yYield) | ||
this.bitorexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1443,5 +1444,5 @@ } | ||
}, | ||
bitorexpr: function(noIn, noOf, yYield) { | ||
bitorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITOREXPR), | ||
bitxorexpr = this.bitxorexpr(noIn, noOf, yYield); | ||
bitxorexpr = this.bitxorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '|') { | ||
@@ -1452,3 +1453,3 @@ node.add(bitxorexpr); | ||
this.match(), | ||
this.bitxorexpr(noIn, noOf, yYield) | ||
this.bitxorexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1462,5 +1463,5 @@ } | ||
}, | ||
bitxorexpr: function(noIn, noOf, yYield) { | ||
bitxorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITXOREXPR), | ||
bitandexpr = this.bitandexpr(noIn, noOf, yYield); | ||
bitandexpr = this.bitandexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '^') { | ||
@@ -1471,3 +1472,3 @@ node.add(bitandexpr); | ||
this.match(), | ||
this.bitandexpr(noIn, noOf, yYield) | ||
this.bitandexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1481,5 +1482,5 @@ } | ||
}, | ||
bitandexpr: function(noIn, noOf, yYield) { | ||
bitandexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITANDEXPR), | ||
eqexpr = this.eqexpr(noIn, noOf, yYield); | ||
eqexpr = this.eqexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '&') { | ||
@@ -1490,3 +1491,3 @@ node.add(eqexpr); | ||
this.match(), | ||
this.eqexpr(noIn, noOf, yYield) | ||
this.eqexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1500,5 +1501,5 @@ } | ||
}, | ||
eqexpr: function(noIn, noOf, yYield) { | ||
eqexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.EQEXPR), | ||
reltexpr = this.reltexpr(noIn, noOf, yYield); | ||
reltexpr = this.reltexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && { | ||
@@ -1519,3 +1520,3 @@ '==': true, | ||
this.match(), | ||
this.reltexpr(noIn, noOf, yYield) | ||
this.reltexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1529,5 +1530,5 @@ } | ||
}, | ||
reltexpr: function(noIn, noOf, yYield) { | ||
reltexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.RELTEXPR), | ||
shiftexpr = this.shiftexpr(); | ||
shiftexpr = this.shiftexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ({ | ||
@@ -1552,3 +1553,3 @@ '<': true, | ||
this.match(), | ||
this.shiftexpr(noIn, noOf, yYield) | ||
this.shiftexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1562,5 +1563,5 @@ } | ||
}, | ||
shiftexpr: function(noIn, noOf, yYield) { | ||
shiftexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.SHIFTEXPR), | ||
addexpr = this.addexpr(noIn, noOf, yYield); | ||
addexpr = this.addexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['<<', '>>', '>>>'].indexOf(this.look.content()) != -1) { | ||
@@ -1571,3 +1572,3 @@ node.add(addexpr); | ||
this.match(), | ||
this.addexpr(noIn, noOf, yYield) | ||
this.addexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1581,5 +1582,5 @@ } | ||
}, | ||
addexpr: function(noIn, noOf, yYield) { | ||
addexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.ADDEXPR), | ||
mtplexpr = this.mtplexpr(noIn, noOf, yYield); | ||
mtplexpr = this.mtplexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['+', '-'].indexOf(this.look.content()) != -1) { | ||
@@ -1590,3 +1591,3 @@ node.add(mtplexpr); | ||
this.match(), | ||
this.mtplexpr(noIn, noOf, yYield) | ||
this.mtplexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1600,5 +1601,5 @@ } | ||
}, | ||
mtplexpr: function(noIn, noOf, yYield) { | ||
mtplexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.MTPLEXPR), | ||
unaryexpr = this.unaryexpr(noIn, noOf, yYield); | ||
unaryexpr = this.unaryexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['*', '/', '%'].indexOf(this.look.content()) != -1) { | ||
@@ -1609,3 +1610,3 @@ node.add(unaryexpr); | ||
this.match(), | ||
this.unaryexpr(noIn, noOf, yYield) | ||
this.unaryexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1619,3 +1620,3 @@ } | ||
}, | ||
unaryexpr: function(noIn, noOf, yYield) { | ||
unaryexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.UNARYEXPR); | ||
@@ -1630,3 +1631,3 @@ if(!this.look) { | ||
this.match(), | ||
this.leftexpr(noIn, noOf, yYield) | ||
this.leftexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1643,13 +1644,13 @@ break; | ||
this.match(), | ||
this.unaryexpr(noIn, noOf, yYield) | ||
this.unaryexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
break; | ||
default: | ||
return this.postfixexpr(noIn, noOf, yYield); | ||
return this.postfixexpr(noIn, noOf, yYield, isConstructor); | ||
} | ||
return node; | ||
}, | ||
postfixexpr: function(noIn, noOf, yYield) { | ||
postfixexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.POSTFIXEXPR); | ||
var leftexpr = this.leftexpr(noIn, noOf, yYield); | ||
var leftexpr = this.leftexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['++', '--'].indexOf(this.look.content()) > -1 && !this.hasMoveLine) { | ||
@@ -1666,3 +1667,3 @@ node.add( | ||
}, | ||
leftexpr: function(noIn, noOf, yYield) { | ||
leftexpr: function(noIn, noOf, yYield, isConstructor) { | ||
if(this.look.content() == 'new') { | ||
@@ -1672,3 +1673,3 @@ return this.newexpr(0, noIn, noOf, yYield); | ||
else { | ||
return this.callexpr(null, noIn, noOf, yYield); | ||
return this.callexpr(null, noIn, noOf, yYield, isConstructor); | ||
} | ||
@@ -1741,3 +1742,3 @@ }, | ||
}, | ||
callexpr: function(mmb, noIn, noOf, yYield) { | ||
callexpr: function(mmb, noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.CALLEXPR); | ||
@@ -1755,2 +1756,5 @@ if(!mmb) { | ||
); | ||
if(!isConstructor) { | ||
this.error('super call is only allowed in derived constructor'); | ||
} | ||
mmb = node; | ||
@@ -1757,0 +1761,0 @@ node = new Node(Node.CALLEXPR); |
@@ -259,3 +259,3 @@ define(function(require, exports, module) {var IParser = require('../Parser'); | ||
}, | ||
stmtlitem: function(yYield) { | ||
stmtlitem: function(yYield, isConstructor) { | ||
if(['function', 'class', 'let', 'const'].indexOf(this.look.content()) > -1) { | ||
@@ -265,3 +265,3 @@ return this.decl(yYield); | ||
else { | ||
return this.stmt(yYield); | ||
return this.stmt(yYield, isConstructor); | ||
} | ||
@@ -296,3 +296,3 @@ }, | ||
}, | ||
stmt: function(yYield) { | ||
stmt: function(yYield, isConstructor) { | ||
if(!this.look) { | ||
@@ -339,3 +339,3 @@ this.error(); | ||
else { | ||
return this.exprstmt(yYield); | ||
return this.exprstmt(yYield, isConstructor); | ||
} | ||
@@ -345,8 +345,8 @@ } | ||
} | ||
return this.exprstmt(yYield); | ||
return this.exprstmt(yYield, isConstructor); | ||
} | ||
}, | ||
exprstmt: function(yYield) { | ||
exprstmt: function(yYield, isConstructor) { | ||
var node = new Node(Node.EXPRSTMT); | ||
node.add(this.expr(null, null, yYield), this.match(';')); | ||
node.add(this.expr(null, null, yYield, isConstructor), this.match(';')); | ||
return node; | ||
@@ -1091,6 +1091,6 @@ }, | ||
}, | ||
fnbody: function(yYield) { | ||
fnbody: function(yYield, isConstructor) { | ||
var node = new Node(Node.FNBODY); | ||
while(this.look && this.look.content() != '}') { | ||
node.add(this.stmtlitem(yYield)); | ||
node.add(this.stmtlitem(yYield, isConstructor)); | ||
} | ||
@@ -1200,2 +1200,3 @@ return node; | ||
else { | ||
var isConstructor = this.look.type() == Token.ID && this.look.content() == 'constructor'; | ||
node.add( | ||
@@ -1207,3 +1208,3 @@ this.proptname(noIn, noOf), | ||
this.match('{'), | ||
this.fnbody(), | ||
this.fnbody(false, isConstructor), | ||
this.match('}') | ||
@@ -1228,5 +1229,5 @@ ); | ||
}, | ||
expr: function(noIn, noOf, yYield) { | ||
expr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.EXPR), | ||
assignexpr = this.assignexpr(noIn, noOf, yYield); | ||
assignexpr = this.assignexpr(noIn, noOf, yYield, isConstructor); | ||
//LL2区分,后的...是否为cpeapl | ||
@@ -1255,3 +1256,3 @@ if(this.look && this.look.content() == ',') { | ||
} | ||
node.add(this.match(), this.assignexpr(noIn, noOf, yYield)); | ||
node.add(this.match(), this.assignexpr(noIn, noOf, yYield, isConstructor)); | ||
} | ||
@@ -1272,3 +1273,3 @@ } | ||
}, | ||
assignexpr: function(noIn, noOf, yYield) { | ||
assignexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.ASSIGNEXPR); | ||
@@ -1284,3 +1285,3 @@ if(!this.look) { | ||
} | ||
var cndt = this.cndtexpr(noIn, noOf, yYield); | ||
var cndt = this.cndtexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look | ||
@@ -1319,3 +1320,3 @@ && this.look.content() == '=>' | ||
&& !NOASSIGN.hasOwnProperty(cndt.name())) { | ||
node.add(cndt, this.match(), this.assignexpr(noIn, noOf, yYield)); | ||
node.add(cndt, this.match(), this.assignexpr(noIn, noOf, yYield, isConstructor)); | ||
} | ||
@@ -1386,5 +1387,5 @@ else { | ||
}, | ||
cndtexpr: function(noIn, noOf, yYield) { | ||
cndtexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.CNDTEXPR), | ||
logorexpr = this.logorexpr(noIn, noOf, yYield); | ||
logorexpr = this.logorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '?') { | ||
@@ -1394,5 +1395,5 @@ node.add( | ||
this.match(), | ||
this.assignexpr(noIn, noOf, yYield), | ||
this.assignexpr(noIn, noOf, yYield, isConstructor), | ||
this.match(':'), | ||
this.assignexpr(noIn, noOf, yYield) | ||
this.assignexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1405,5 +1406,5 @@ } | ||
}, | ||
logorexpr: function(noIn, noOf, yYield) { | ||
logorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.LOGOREXPR), | ||
logandexpr = this.logandexpr(noIn, noOf, yYield); | ||
logandexpr = this.logandexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '||') { | ||
@@ -1414,3 +1415,3 @@ node.add(logandexpr); | ||
this.match(), | ||
this.logandexpr(noIn, noOf, yYield) | ||
this.logandexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1424,5 +1425,5 @@ } | ||
}, | ||
logandexpr: function(noIn, noOf, yYield) { | ||
logandexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.LOGANDEXPR), | ||
bitorexpr = this.bitorexpr(noIn, noOf); | ||
bitorexpr = this.bitorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '&&') { | ||
@@ -1433,3 +1434,3 @@ node.add(bitorexpr); | ||
this.match(), | ||
this.bitorexpr(noIn, noOf, yYield) | ||
this.bitorexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1443,5 +1444,5 @@ } | ||
}, | ||
bitorexpr: function(noIn, noOf, yYield) { | ||
bitorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITOREXPR), | ||
bitxorexpr = this.bitxorexpr(noIn, noOf, yYield); | ||
bitxorexpr = this.bitxorexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '|') { | ||
@@ -1452,3 +1453,3 @@ node.add(bitxorexpr); | ||
this.match(), | ||
this.bitxorexpr(noIn, noOf, yYield) | ||
this.bitxorexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1462,5 +1463,5 @@ } | ||
}, | ||
bitxorexpr: function(noIn, noOf, yYield) { | ||
bitxorexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITXOREXPR), | ||
bitandexpr = this.bitandexpr(noIn, noOf, yYield); | ||
bitandexpr = this.bitandexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '^') { | ||
@@ -1471,3 +1472,3 @@ node.add(bitandexpr); | ||
this.match(), | ||
this.bitandexpr(noIn, noOf, yYield) | ||
this.bitandexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1481,5 +1482,5 @@ } | ||
}, | ||
bitandexpr: function(noIn, noOf, yYield) { | ||
bitandexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.BITANDEXPR), | ||
eqexpr = this.eqexpr(noIn, noOf, yYield); | ||
eqexpr = this.eqexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && this.look.content() == '&') { | ||
@@ -1490,3 +1491,3 @@ node.add(eqexpr); | ||
this.match(), | ||
this.eqexpr(noIn, noOf, yYield) | ||
this.eqexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1500,5 +1501,5 @@ } | ||
}, | ||
eqexpr: function(noIn, noOf, yYield) { | ||
eqexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.EQEXPR), | ||
reltexpr = this.reltexpr(noIn, noOf, yYield); | ||
reltexpr = this.reltexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && { | ||
@@ -1519,3 +1520,3 @@ '==': true, | ||
this.match(), | ||
this.reltexpr(noIn, noOf, yYield) | ||
this.reltexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1529,5 +1530,5 @@ } | ||
}, | ||
reltexpr: function(noIn, noOf, yYield) { | ||
reltexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.RELTEXPR), | ||
shiftexpr = this.shiftexpr(); | ||
shiftexpr = this.shiftexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ({ | ||
@@ -1552,3 +1553,3 @@ '<': true, | ||
this.match(), | ||
this.shiftexpr(noIn, noOf, yYield) | ||
this.shiftexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1562,5 +1563,5 @@ } | ||
}, | ||
shiftexpr: function(noIn, noOf, yYield) { | ||
shiftexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.SHIFTEXPR), | ||
addexpr = this.addexpr(noIn, noOf, yYield); | ||
addexpr = this.addexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['<<', '>>', '>>>'].indexOf(this.look.content()) != -1) { | ||
@@ -1571,3 +1572,3 @@ node.add(addexpr); | ||
this.match(), | ||
this.addexpr(noIn, noOf, yYield) | ||
this.addexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1581,5 +1582,5 @@ } | ||
}, | ||
addexpr: function(noIn, noOf, yYield) { | ||
addexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.ADDEXPR), | ||
mtplexpr = this.mtplexpr(noIn, noOf, yYield); | ||
mtplexpr = this.mtplexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['+', '-'].indexOf(this.look.content()) != -1) { | ||
@@ -1590,3 +1591,3 @@ node.add(mtplexpr); | ||
this.match(), | ||
this.mtplexpr(noIn, noOf, yYield) | ||
this.mtplexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1600,5 +1601,5 @@ } | ||
}, | ||
mtplexpr: function(noIn, noOf, yYield) { | ||
mtplexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.MTPLEXPR), | ||
unaryexpr = this.unaryexpr(noIn, noOf, yYield); | ||
unaryexpr = this.unaryexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['*', '/', '%'].indexOf(this.look.content()) != -1) { | ||
@@ -1609,3 +1610,3 @@ node.add(unaryexpr); | ||
this.match(), | ||
this.unaryexpr(noIn, noOf, yYield) | ||
this.unaryexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1619,3 +1620,3 @@ } | ||
}, | ||
unaryexpr: function(noIn, noOf, yYield) { | ||
unaryexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.UNARYEXPR); | ||
@@ -1630,3 +1631,3 @@ if(!this.look) { | ||
this.match(), | ||
this.leftexpr(noIn, noOf, yYield) | ||
this.leftexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
@@ -1643,13 +1644,13 @@ break; | ||
this.match(), | ||
this.unaryexpr(noIn, noOf, yYield) | ||
this.unaryexpr(noIn, noOf, yYield, isConstructor) | ||
); | ||
break; | ||
default: | ||
return this.postfixexpr(noIn, noOf, yYield); | ||
return this.postfixexpr(noIn, noOf, yYield, isConstructor); | ||
} | ||
return node; | ||
}, | ||
postfixexpr: function(noIn, noOf, yYield) { | ||
postfixexpr: function(noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.POSTFIXEXPR); | ||
var leftexpr = this.leftexpr(noIn, noOf, yYield); | ||
var leftexpr = this.leftexpr(noIn, noOf, yYield, isConstructor); | ||
if(this.look && ['++', '--'].indexOf(this.look.content()) > -1 && !this.hasMoveLine) { | ||
@@ -1666,3 +1667,3 @@ node.add( | ||
}, | ||
leftexpr: function(noIn, noOf, yYield) { | ||
leftexpr: function(noIn, noOf, yYield, isConstructor) { | ||
if(this.look.content() == 'new') { | ||
@@ -1672,3 +1673,3 @@ return this.newexpr(0, noIn, noOf, yYield); | ||
else { | ||
return this.callexpr(null, noIn, noOf, yYield); | ||
return this.callexpr(null, noIn, noOf, yYield, isConstructor); | ||
} | ||
@@ -1741,3 +1742,3 @@ }, | ||
}, | ||
callexpr: function(mmb, noIn, noOf, yYield) { | ||
callexpr: function(mmb, noIn, noOf, yYield, isConstructor) { | ||
var node = new Node(Node.CALLEXPR); | ||
@@ -1755,2 +1756,5 @@ if(!mmb) { | ||
); | ||
if(!isConstructor) { | ||
this.error('super call is only allowed in derived constructor'); | ||
} | ||
mmb = node; | ||
@@ -1757,0 +1761,0 @@ node = new Node(Node.CALLEXPR); |
Sorry, the diff of this file is not supported yet
17785
0.05%1237754
-0.1%