Fix tests - comma operator

This commit is contained in:
Jindra Petřík
2021-02-26 22:46:28 +01:00
parent ae0e590bea
commit 8e496d8655
2 changed files with 122 additions and 126 deletions
@@ -199,7 +199,7 @@ public class ActionScript3Parser {
break;
case FILTER:
needsActivation.setVal(true);
ret = new XMLFilterAVM2Item(ret, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, inMethod, variables), openedNamespaces);
ret = new XMLFilterAVM2Item(ret, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, inMethod, variables, false), openedNamespaces);
expectedType(SymbolType.PARENT_CLOSE);
break;
case PARENT_OPEN:
@@ -293,7 +293,7 @@ public class ActionScript3Parser {
ret = applyType(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables);
s = lex();
} else if (s.type == SymbolType.BRACKET_OPEN) {
GraphTargetItem index = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem index = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.BRACKET_CLOSE);
ret = new IndexAVM2Item(attr, ret, index, null, openedNamespaces);
s = lex();
@@ -309,7 +309,7 @@ public class ActionScript3Parser {
variables.add((UnresolvedAVM2Item) ns);
s = lex();
if (s.type == SymbolType.BRACKET_OPEN) {
propItem = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
propItem = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.BRACKET_CLOSE);
propName = null;
} else {
@@ -384,7 +384,7 @@ public class ActionScript3Parser {
if (s.group == SymbolGroup.IDENTIFIER) {
nsprop = s.value.toString();
} else if (s.type == SymbolType.BRACKET_OPEN) {
nspropItem = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
nspropItem = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.BRACKET_CLOSE);
}
name = name.getWithoutLast();
@@ -466,7 +466,7 @@ public class ActionScript3Parser {
if (s.type != SymbolType.COMMA) {
lexer.pushback(s);
}
ret.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
s = lex();
expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.PARENT_CLOSE);
}
@@ -511,7 +511,7 @@ public class ActionScript3Parser {
paramTypes.add(new UnboundedTypeItem());
}
if (s.type == SymbolType.ASSIGN) {
paramValues.add(expression(allOpenedNamespaces, thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables));
paramValues.add(expression(allOpenedNamespaces, thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables, false));
s = lex();
} else if (!paramValues.isEmpty()) {
throw new AVM2ParseException("Some of parameters do not have default values", lexer.yyline());
@@ -845,7 +845,7 @@ public class ActionScript3Parser {
GraphTargetItem value = null;
if (s.type == SymbolType.ASSIGN) {
value = expression(allOpenedNamespaces, thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<>(), false, false, true, isStatic || isConst ? cinitVariables : iinitVariables);
value = expression(allOpenedNamespaces, thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<>(), false, false, true, isStatic || isConst ? cinitVariables : iinitVariables, false);
s = lex();
}
GraphTargetItem tar;
@@ -1068,7 +1068,7 @@ public class ActionScript3Parser {
GraphTargetItem value = null;
if (s.type == SymbolType.ASSIGN) {
value = expression(allOpenedNamespaces, null, ns, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<>(), false, false, true, sinitVariables);
value = expression(allOpenedNamespaces, null, ns, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<>(), false, false, true, sinitVariables, false);
s = lex();
}
GraphTargetItem tar;
@@ -1231,7 +1231,7 @@ public class ActionScript3Parser {
case XML_ATTRNAMEVAR_BEGIN: //add
usesVars.setVal(true);
addS(rets, sb);
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.CURLY_CLOSE);
expectedType(SymbolType.ASSIGN);
sb.append("=");
@@ -1241,7 +1241,7 @@ public class ActionScript3Parser {
usesVars.setVal(true);
sb.append("\"");
addS(rets, sb);
rets.add(new EscapeXAttrAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)));
rets.add(new EscapeXAttrAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false)));
sb.append("\"");
expectedType(SymbolType.CURLY_CLOSE);
lexer.yybegin(ActionScriptLexer.XMLOPENTAG);
@@ -1249,7 +1249,7 @@ public class ActionScript3Parser {
case XML_INSTRATTRNAMEVAR_BEGIN: //add
usesVars.setVal(true);
addS(rets, sb);
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.CURLY_CLOSE);
expectedType(SymbolType.ASSIGN);
sb.append("=");
@@ -1259,7 +1259,7 @@ public class ActionScript3Parser {
usesVars.setVal(true);
sb.append("\"");
addS(rets, sb);
rets.add(new EscapeXAttrAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)));
rets.add(new EscapeXAttrAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false)));
sb.append("\"");
expectedType(SymbolType.CURLY_CLOSE);
lexer.yybegin(ActionScriptLexer.XMLOPENTAG);
@@ -1267,7 +1267,7 @@ public class ActionScript3Parser {
case XML_VAR_BEGIN: //esc_xelem
usesVars.setVal(true);
addS(rets, sb);
rets.add(new EscapeXElemAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)));
rets.add(new EscapeXElemAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false)));
expectedType(SymbolType.CURLY_CLOSE);
lexer.yybegin(ActionScriptLexer.XML);
break;
@@ -1277,7 +1277,7 @@ public class ActionScript3Parser {
sb.append("</");
addS(rets, sb);
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.CURLY_CLOSE);
expectedType(SymbolType.GREATER_THAN);
sb.append(">");
@@ -1288,7 +1288,7 @@ public class ActionScript3Parser {
//openedTags.add("*");
//ret = add(ret, );
GraphTargetItem ex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem ex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.CURLY_CLOSE);
lexer.yybegin(ActionScriptLexer.XMLOPENTAG);
sub.add("*");
@@ -1303,7 +1303,7 @@ public class ActionScript3Parser {
addS(rets, sb);
sb.append("<?");
addS(rets, sb);
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
rets.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.CURLY_CLOSE);
lexer.yybegin(ActionScriptLexer.XMLINSTROPENTAG);
break;
@@ -1388,7 +1388,7 @@ public class ActionScript3Parser {
} else {
expectedType(SymbolType.NAMESPACE);
expectedType(SymbolType.ASSIGN);
GraphTargetItem ns = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem ns = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
ret = new DefaultXMLNamespace(null, null, ns);
//TODO: use dxns for attribute namespaces instead of dxnslate
}
@@ -1403,7 +1403,7 @@ public class ActionScript3Parser {
case WITH:
needsActivation.setVal(true);
expectedType(SymbolType.PARENT_OPEN);
GraphTargetItem wvar = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//(name(allOpenedNamespaces, thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables));
GraphTargetItem wvar = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);//(name(allOpenedNamespaces, thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables));
if (!isNameOrProp(wvar)) {
throw new AVM2ParseException("Not a property or name", lexer.yyline());
}
@@ -1457,7 +1457,7 @@ public class ActionScript3Parser {
}
if (s.type == SymbolType.ASSIGN) {
GraphTargetItem varval = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
GraphTargetItem varval = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
ret = new NameAVM2Item(type, lexer.yyline(), varIdentifier, varval, true, openedNamespaces, abcIndex);
variables.add((NameAVM2Item) ret);
} else {
@@ -1494,7 +1494,7 @@ public class ActionScript3Parser {
break;
case IF:
expectedType(SymbolType.PARENT_OPEN);
GraphTargetItem ifExpr = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
GraphTargetItem ifExpr = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.PARENT_CLOSE);
GraphTargetItem onTrue = command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables);
List<GraphTargetItem> onTrueList = new ArrayList<>();
@@ -1512,7 +1512,7 @@ public class ActionScript3Parser {
case WHILE:
expectedType(SymbolType.PARENT_OPEN);
List<GraphTargetItem> whileExpr = new ArrayList<>();
whileExpr.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
whileExpr.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true));
expectedType(SymbolType.PARENT_CLOSE);
List<GraphTargetItem> whileBody = new ArrayList<>();
Loop wloop = new Loop(uniqId(), null, null);
@@ -1534,7 +1534,7 @@ public class ActionScript3Parser {
expectedType(SymbolType.WHILE);
expectedType(SymbolType.PARENT_OPEN);
List<GraphTargetItem> doExpr = new ArrayList<>();
doExpr.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
doExpr.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true));
expectedType(SymbolType.PARENT_CLOSE);
ret = new DoWhileItem(null, null, dloop, doBody, doExpr);
break;
@@ -1577,13 +1577,9 @@ public class ActionScript3Parser {
if (firstCommand != null) { //can be empty command
forFirstCommands.add(firstCommand);
}
while (s.isType(SymbolType.COMMA)) {
forFirstCommands.add(command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, false, variables));
s = lex();
}
lexer.pushback(s);
//GraphTargetItem firstCommand = command(thisType,pkg,needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables);
forExpr = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
forExpr = (expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
expectedType(SymbolType.SEMICOLON);
GraphTargetItem fcom = command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables);
if (fcom != null) {
@@ -1611,7 +1607,7 @@ public class ActionScript3Parser {
loopLabels.put(sloop, loopLabel);
}
expectedType(SymbolType.PARENT_OPEN);
GraphTargetItem switchExpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem switchExpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.PARENT_CLOSE);
expectedType(SymbolType.CURLY_OPEN);
s = lex();
@@ -1631,7 +1627,7 @@ public class ActionScript3Parser {
int pos = 0;
while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) {
while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) {
GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem() : expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem() : expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.COLON);
s = lex();
caseExprsAll.add(curCaseExpr);
@@ -1705,7 +1701,7 @@ public class ActionScript3Parser {
ret = new ContinueItem(null, null, cloopId);
break;
case RETURN:
GraphTargetItem retexpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem retexpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables, false);
if (retexpr == null) {
ret = new ReturnVoidAVM2Item(null, null);
} else {
@@ -1799,7 +1795,7 @@ public class ActionScript3Parser {
ret = tai;
break;
case THROW:
ret = new ThrowAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret = new ThrowAVM2Item(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
break;
default:
GraphTargetItem valcmd = expressionCommands(s, registerVars, inFunction, inMethod, forinlevel, variables);
@@ -1811,7 +1807,7 @@ public class ActionScript3Parser {
return null;
}
lexer.pushback(s);
ret = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
ret = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true);
if (debugMode) {
System.out.println("/command");
}
@@ -1823,7 +1819,7 @@ public class ActionScript3Parser {
lexer.removeListener(buf);
if (ret == null) { //can be popped expression
buf.pushAllBack(lexer);
ret = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
ret = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
}
s = lex();
if ((s != null) && (s.type != SymbolType.SEMICOLON)) {
@@ -1834,8 +1830,8 @@ public class ActionScript3Parser {
}
private GraphTargetItem expression(List<List<NamespaceItem>> allOpenedNamespaces, TypeItem thisType, NamespaceItem pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<NamespaceItem> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
return expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables);
private GraphTargetItem expression(List<List<NamespaceItem>> allOpenedNamespaces, TypeItem thisType, NamespaceItem pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<NamespaceItem> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables, boolean allowComma) throws IOException, AVM2ParseException {
return expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables, allowComma);
}
/*private GraphTargetItem expressionRemainder(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<NamespaceItem> openedNamespaces, GraphTargetItem expr, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables, List<DottedChain> importedClasses) throws IOException, AVM2ParseException {
@@ -1879,7 +1875,7 @@ public class ActionScript3Parser {
lexer.pushback(s);
}
arrCnt++;
ret.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
s = lex();
if (!s.isType(SymbolType.COMMA, SymbolType.BRACKET_CLOSE)) {
expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.BRACKET_CLOSE);
@@ -1892,7 +1888,7 @@ public class ActionScript3Parser {
return arrCnt;
}
private GraphTargetItem expression(List<List<NamespaceItem>> allOpenedNamespaces, TypeItem thisType, NamespaceItem pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<NamespaceItem> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
private GraphTargetItem expression(List<List<NamespaceItem>> allOpenedNamespaces, TypeItem thisType, NamespaceItem pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<NamespaceItem> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables, boolean allowComma) throws IOException, AVM2ParseException {
List<GraphTargetItem> commaItems = new ArrayList<>();
ParsedSymbol symb;
@@ -1904,7 +1900,7 @@ public class ActionScript3Parser {
GraphTargetItem item = expression1(allOpenedNamespaces, prim, GraphTargetItem.NOPRECEDENCE, thisType, pkg, needsActivation, importedClasses, openedNamespaces, allowEmpty, registerVars, inFunction, inMethod, allowRemainder, variables);
commaItems.add(item);
symb = lex();
} while (symb != null && symb.type == SymbolType.COMMA);
} while (allowComma && symb != null && symb.type == SymbolType.COMMA);
if (symb != null) {
lexer.pushback(symb);
}
@@ -1983,7 +1979,7 @@ public class ActionScript3Parser {
if (debugMode) {
System.out.println("ternar-middle:");
}
mhs = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables);
mhs = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables, false);
expectedType(SymbolType.COLON);
if (debugMode) {
System.out.println("/ternar-middle");
@@ -2162,7 +2158,7 @@ public class ActionScript3Parser {
}
}
if (lhs instanceof ParenthesisItem) {
GraphTargetItem coerced = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables);
GraphTargetItem coerced = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables, false);
if (coerced != null && isType(((ParenthesisItem) lhs).value)) {
lhs = new CoerceAVM2Item(null, null, ((ParenthesisItem) lhs).value, coerced);
}
@@ -2187,36 +2183,36 @@ public class ActionScript3Parser {
switch ("" + s.value) {
//AS3
case "hasnext":
GraphTargetItem hnIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem hnIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.COMMA);
GraphTargetItem hnObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem hnObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
ret = new HasNextAVM2Item(null, null, hnIndex, hnObject);
break;
case "newactivation":
ret = new NewActivationAVM2Item(null, null);
break;
case "nextname":
GraphTargetItem nnIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem nnIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.COMMA);
GraphTargetItem nnObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem nnObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
ret = new NextNameAVM2Item(null, null, nnIndex, nnObject);
allowMemberOrCall = true;
break;
case "nextvalue":
GraphTargetItem nvIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem nvIndex = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
expectedType(SymbolType.COMMA);
GraphTargetItem nvObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem nvObject = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
ret = new NextNameAVM2Item(null, null, nvIndex, nvObject);
allowMemberOrCall = true;
break;
//Both ASs
case "dup":
ret = new DuplicateItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret = new DuplicateItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
break;
case "push":
ret = new PushItem(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret = new PushItem(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false));
break;
case "pop":
ret = new PopItem(null, null);
@@ -2311,7 +2307,7 @@ public class ActionScript3Parser {
GraphTargetItem n = new StringAVM2Item(null, null, s.value.toString());
//expression(allOpenedNamespaces, thisType,pkg,needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables);
expectedType(SymbolType.COLON);
GraphTargetItem v = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables);
GraphTargetItem v = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables, false);
NameValuePair nv = new NameValuePair(n, v);
nvs.add(nv);
@@ -2385,7 +2381,7 @@ public class ActionScript3Parser {
break;
case PARENT_OPEN:
ret = new ParenthesisItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables));
ret = new ParenthesisItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true));
expectedType(SymbolType.PARENT_CLOSE);
if (ret.value == null) {
throw new AVM2ParseException("Expression in parenthesis expected", lexer.yyline());
@@ -2418,7 +2414,7 @@ public class ActionScript3Parser {
brackets(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, params, registerVars, inFunction, inMethod, variables);
ret = new InitVectorAVM2Item(subtype, params, openedNamespaces);
} else if (s.type == SymbolType.PARENT_OPEN) {
GraphTargetItem newvar = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
GraphTargetItem newvar = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false);
newvar = applyType(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, newvar, registerVars, inFunction, inMethod, variables);
expectedType(SymbolType.PARENT_CLOSE);
expectedType(SymbolType.PARENT_OPEN);