Program: 61553
Project: 61553
Buggy source:
private GraphTargetItem expressionPrimary(TypeItem thisType,String pkg,Reference<Boolean> needsActivation,List<String> importedClasses,List<Integer> openedNamespaces,boolean allowEmpty,HashMap<String,Integer> registerVars,boolean inFunction,boolean inMethod,boolean allowRemainder,List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
  if (debugMode) {
    System.out.println("String_Node_Str");
  }
  GraphTargetItem ret=null;
  ParsedSymbol s=lex();
  boolean allowMemberOrCall=false;
switch (s.type) {
case XML_STARTTAG_BEGIN:
    lexer.pushback(s);
  ret=xml(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables);
break;
case STRING:
ret=new StringAVM2Item(null,s.value.toString());
allowMemberOrCall=true;
break;
case NEGATE:
ret=expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,false,variables);
ret=new NegAVM2Item(null,ret);
break;
case MINUS:
s=lex();
if (s.isType(SymbolType.DOUBLE)) {
ret=new FloatValueAVM2Item(null,-(Double)s.value);
}
 else if (s.isType(SymbolType.INTEGER)) {
ret=new IntegerValueAVM2Item(null,-(Long)s.value);
}
 else {
lexer.pushback(s);
GraphTargetItem num=expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables);
if (num instanceof IntegerValueAVM2Item) {
((IntegerValueAVM2Item)num).value=-((IntegerValueAVM2Item)num).value;
ret=num;
}
 else if (num instanceof FloatValueAVM2Item) {
Double d=((FloatValueAVM2Item)num).value;
if (d.isInfinite()) {
((FloatValueAVM2Item)num).value=Double.NEGATIVE_INFINITY;
}
 else {
((FloatValueAVM2Item)num).value=-d;
}
ret=(num);
}
 else {
ret=(new SubtractAVM2Item(null,new IntegerValueAVM2Item(null,0L),num));
}
}
break;
case TYPEOF:
ret=new TypeOfAVM2Item(null,expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,false,variables));
break;
case TRUE:
ret=new BooleanAVM2Item(null,true);
break;
case NULL:
ret=new NullAVM2Item(null);
break;
case UNDEFINED:
ret=new UndefinedAVM2Item(null);
break;
case FALSE:
ret=new BooleanAVM2Item(null,false);
break;
case CURLY_OPEN:
s=lex();
List<NameValuePair> nvs=new ArrayList<>();
while (s.type != SymbolType.CURLY_CLOSE) {
if (s.type != SymbolType.COMMA) {
lexer.pushback(s);
}
s=lex();
expected(s,lexer.yyline(),SymbolGroup.IDENTIFIER,SymbolType.STRING);
GraphTargetItem n=new StringAVM2Item(null,s.value.toString());
expectedType(SymbolType.COLON);
GraphTargetItem v=expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,allowRemainder,variables);
NameValuePair nv=new NameValuePair(n,v);
nvs.add(nv);
s=lex();
if (!s.isType(SymbolType.COMMA,SymbolType.CURLY_CLOSE)) {
expected(s,lexer.yyline(),SymbolType.COMMA,SymbolType.CURLY_CLOSE);
}
}
ret=new NewObjectAVM2Item(null,nvs);
allowMemberOrCall=true;
break;
case BRACKET_OPEN:
lexer.pushback(s);
List<GraphTargetItem> inBrackets=new ArrayList<>();
int arrCnt=brackets(thisType,pkg,needsActivation,importedClasses,openedNamespaces,inBrackets,registerVars,inFunction,inMethod,variables);
ret=new NewArrayAVM2Item(null,inBrackets);
break;
case FUNCTION:
s=lexer.lex();
String fname="String_Node_Str";
if (s.isType(SymbolGroup.IDENTIFIER)) {
fname=s.value.toString();
}
 else {
lexer.pushback(s);
}
needsActivation.setVal(true);
ret=function(pkg,false,needsActivation,importedClasses,0,thisType,openedNamespaces,fname,false,variables);
allowMemberOrCall=true;
break;
case NAN:
ret=new NanAVM2Item(null);
break;
case INFINITY:
ret=new FloatValueAVM2Item(null,Double.POSITIVE_INFINITY);
break;
case INTEGER:
ret=new IntegerValueAVM2Item(null,(Long)s.value);
break;
case DOUBLE:
ret=new FloatValueAVM2Item(null,(Double)s.value);
break;
case DELETE:
GraphTargetItem varDel=expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables);
if (!isNameOrProp(varDel)) {
throw new AVM2ParseException("String_Node_Str",lexer.yyline());
}
ret=new DeletePropertyAVM2Item(varDel,lexer.yyline());
break;
case INCREMENT:
case DECREMENT:
GraphTargetItem varincdec=expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,false,variables);
if (!isNameOrProp(varincdec)) {
throw new AVM2ParseException("String_Node_Str",lexer.yyline());
}
if (s.type == SymbolType.INCREMENT) {
ret=new PreIncrementAVM2Item(null,varincdec);
}
if (s.type == SymbolType.DECREMENT) {
ret=new PreDecrementAVM2Item(null,varincdec);
}
break;
case NOT:
ret=new NotItem(null,expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,false,variables));
break;
case PARENT_OPEN:
ret=new ParenthesisItem(null,expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables));
expectedType(SymbolType.PARENT_CLOSE);
allowMemberOrCall=true;
break;
case NEW:
s=lex();
if (s.type == SymbolType.XML_STARTTAG_BEGIN) {
lexer.yypushbackstr(s.value.toString().substring(1),ActionScriptLexer.YYINITIAL);
s=new ParsedSymbol(SymbolGroup.OPERATOR,SymbolType.LOWER_THAN);
}
if (s.type == SymbolType.FUNCTION) {
s=lexer.lex();
String ffname="String_Node_Str";
if (s.isType(SymbolGroup.IDENTIFIER)) {
ffname=s.value.toString();
}
 else {
lexer.pushback(s);
}
needsActivation.setVal(true);
ret=function(pkg,false,needsActivation,importedClasses,0,thisType,openedNamespaces,ffname,false,variables);
}
 else if (s.type == SymbolType.LOWER_THAN) {
GraphTargetItem subtype=type(thisType,pkg,needsActivation,importedClasses,openedNamespaces,variables);
expectedType(SymbolType.GREATER_THAN);
s=lex();
expected(s,lexer.yyline(),SymbolType.BRACKET_OPEN);
lexer.pushback(s);
List<GraphTargetItem> params=new ArrayList<>();
brackets(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(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables);
newvar=applyType(thisType,pkg,needsActivation,importedClasses,openedNamespaces,newvar,registerVars,inFunction,inMethod,variables);
expectedType(SymbolType.PARENT_CLOSE);
expectedType(SymbolType.PARENT_OPEN);
ret=new ConstructSomethingAVM2Item(lexer.yyline(),openedNamespaces,newvar,call(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables));
}
 else {
lexer.pushback(s);
GraphTargetItem newvar=name(thisType,pkg,needsActivation,false,openedNamespaces,registerVars,inFunction,inMethod,variables,importedClasses);
newvar=applyType(thisType,pkg,needsActivation,importedClasses,openedNamespaces,newvar,registerVars,inFunction,inMethod,variables);
expectedType(SymbolType.PARENT_OPEN);
ret=new ConstructSomethingAVM2Item(lexer.yyline(),openedNamespaces,newvar,call(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables));
}
break;
case IDENTIFIER:
case THIS:
case SUPER:
case ATTRIBUTE:
lexer.pushback(s);
ret=name(thisType,pkg,needsActivation,false,openedNamespaces,registerVars,inFunction,inMethod,variables,importedClasses);
allowMemberOrCall=true;
break;
default :
GraphTargetItem excmd=expressionCommands(s,registerVars,inFunction,inMethod,-1,variables);
if (excmd != null) {
ret=excmd;
allowMemberOrCall=true;
break;
}
lexer.pushback(s);
}
if (allowMemberOrCall && ret != null) {
ret=memberOrCall(thisType,pkg,needsActivation,importedClasses,openedNamespaces,ret,registerVars,inFunction,inMethod,variables);
}
if (debugMode) {
System.out.println("String_Node_Str");
}
return ret;
}

Fixed version (ground truth):
private GraphTargetItem expressionPrimary(TypeItem thisType,String pkg,Reference<Boolean> needsActivation,List<String> importedClasses,List<Integer> openedNamespaces,boolean allowEmpty,HashMap<String,Integer> registerVars,boolean inFunction,boolean inMethod,boolean allowRemainder,List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
  if (debugMode) {
    System.out.println("String_Node_Str");
  }
  GraphTargetItem ret=null;
  ParsedSymbol s=lex();
  boolean allowMemberOrCall=false;
switch (s.type) {
case XML_STARTTAG_BEGIN:
    lexer.pushback(s);
  ret=xml(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables);
break;
case STRING:
ret=new StringAVM2Item(null,s.value.toString());
allowMemberOrCall=true;
break;
case NEGATE:
ret=expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,false,variables);
ret=new NegAVM2Item(null,ret);
break;
case MINUS:
s=lex();
if (s.isType(SymbolType.DOUBLE)) {
ret=new FloatValueAVM2Item(null,-(Double)s.value);
}
 else if (s.isType(SymbolType.INTEGER)) {
ret=new IntegerValueAVM2Item(null,-(Long)s.value);
}
 else {
lexer.pushback(s);
GraphTargetItem num=expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,true,variables);
if (num instanceof IntegerValueAVM2Item) {
((IntegerValueAVM2Item)num).value=-((IntegerValueAVM2Item)num).value;
ret=num;
}
 else if (num instanceof FloatValueAVM2Item) {
Double d=((FloatValueAVM2Item)num).value;
if (d.isInfinite()) {
((FloatValueAVM2Item)num).value=Double.NEGATIVE_INFINITY;
}
 else {
((FloatValueAVM2Item)num).value=-d;
}
ret=(num);
}
 else {
ret=(new SubtractAVM2Item(null,new IntegerValueAVM2Item(null,0L),num));
}
}
break;
case TYPEOF:
ret=new TypeOfAVM2Item(null,expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,false,variables));
break;
case TRUE:
ret=new BooleanAVM2Item(null,true);
break;
case NULL:
ret=new NullAVM2Item(null);
break;
case UNDEFINED:
ret=new UndefinedAVM2Item(null);
break;
case FALSE:
ret=new BooleanAVM2Item(null,false);
break;
case CURLY_OPEN:
s=lex();
List<NameValuePair> nvs=new ArrayList<>();
while (s.type != SymbolType.CURLY_CLOSE) {
if (s.type != SymbolType.COMMA) {
lexer.pushback(s);
}
s=lex();
expected(s,lexer.yyline(),SymbolGroup.IDENTIFIER,SymbolType.STRING);
GraphTargetItem n=new StringAVM2Item(null,s.value.toString());
expectedType(SymbolType.COLON);
GraphTargetItem v=expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,allowRemainder,variables);
NameValuePair nv=new NameValuePair(n,v);
nvs.add(nv);
s=lex();
if (!s.isType(SymbolType.COMMA,SymbolType.CURLY_CLOSE)) {
expected(s,lexer.yyline(),SymbolType.COMMA,SymbolType.CURLY_CLOSE);
}
}
ret=new NewObjectAVM2Item(null,nvs);
allowMemberOrCall=true;
break;
case BRACKET_OPEN:
lexer.pushback(s);
List<GraphTargetItem> inBrackets=new ArrayList<>();
int arrCnt=brackets(thisType,pkg,needsActivation,importedClasses,openedNamespaces,inBrackets,registerVars,inFunction,inMethod,variables);
ret=new NewArrayAVM2Item(null,inBrackets);
break;
case FUNCTION:
s=lexer.lex();
String fname="String_Node_Str";
if (s.isType(SymbolGroup.IDENTIFIER)) {
fname=s.value.toString();
}
 else {
lexer.pushback(s);
}
needsActivation.setVal(true);
ret=function(pkg,false,needsActivation,importedClasses,0,thisType,openedNamespaces,fname,false,variables);
allowMemberOrCall=true;
break;
case NAN:
ret=new NanAVM2Item(null);
break;
case INFINITY:
ret=new FloatValueAVM2Item(null,Double.POSITIVE_INFINITY);
break;
case INTEGER:
ret=new IntegerValueAVM2Item(null,(Long)s.value);
break;
case DOUBLE:
ret=new FloatValueAVM2Item(null,(Double)s.value);
break;
case DELETE:
GraphTargetItem varDel=expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,true,variables);
if (!isNameOrProp(varDel)) {
throw new AVM2ParseException("String_Node_Str",lexer.yyline());
}
ret=new DeletePropertyAVM2Item(varDel,lexer.yyline());
break;
case INCREMENT:
case DECREMENT:
GraphTargetItem varincdec=expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,false,variables);
if (!isNameOrProp(varincdec)) {
throw new AVM2ParseException("String_Node_Str",lexer.yyline());
}
if (s.type == SymbolType.INCREMENT) {
ret=new PreIncrementAVM2Item(null,varincdec);
}
if (s.type == SymbolType.DECREMENT) {
ret=new PreDecrementAVM2Item(null,varincdec);
}
break;
case NOT:
ret=new NotItem(null,expressionPrimary(thisType,pkg,needsActivation,importedClasses,openedNamespaces,false,registerVars,inFunction,inMethod,false,variables));
break;
case PARENT_OPEN:
ret=new ParenthesisItem(null,expression(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables));
expectedType(SymbolType.PARENT_CLOSE);
allowMemberOrCall=true;
break;
case NEW:
s=lex();
if (s.type == SymbolType.XML_STARTTAG_BEGIN) {
lexer.yypushbackstr(s.value.toString().substring(1),ActionScriptLexer.YYINITIAL);
s=new ParsedSymbol(SymbolGroup.OPERATOR,SymbolType.LOWER_THAN);
}
if (s.type == SymbolType.FUNCTION) {
s=lexer.lex();
String ffname="String_Node_Str";
if (s.isType(SymbolGroup.IDENTIFIER)) {
ffname=s.value.toString();
}
 else {
lexer.pushback(s);
}
needsActivation.setVal(true);
ret=function(pkg,false,needsActivation,importedClasses,0,thisType,openedNamespaces,ffname,false,variables);
}
 else if (s.type == SymbolType.LOWER_THAN) {
GraphTargetItem subtype=type(thisType,pkg,needsActivation,importedClasses,openedNamespaces,variables);
expectedType(SymbolType.GREATER_THAN);
s=lex();
expected(s,lexer.yyline(),SymbolType.BRACKET_OPEN);
lexer.pushback(s);
List<GraphTargetItem> params=new ArrayList<>();
brackets(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(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,true,variables);
newvar=applyType(thisType,pkg,needsActivation,importedClasses,openedNamespaces,newvar,registerVars,inFunction,inMethod,variables);
expectedType(SymbolType.PARENT_CLOSE);
expectedType(SymbolType.PARENT_OPEN);
ret=new ConstructSomethingAVM2Item(lexer.yyline(),openedNamespaces,newvar,call(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables));
}
 else {
lexer.pushback(s);
GraphTargetItem newvar=name(thisType,pkg,needsActivation,false,openedNamespaces,registerVars,inFunction,inMethod,variables,importedClasses);
newvar=applyType(thisType,pkg,needsActivation,importedClasses,openedNamespaces,newvar,registerVars,inFunction,inMethod,variables);
expectedType(SymbolType.PARENT_OPEN);
ret=new ConstructSomethingAVM2Item(lexer.yyline(),openedNamespaces,newvar,call(thisType,pkg,needsActivation,importedClasses,openedNamespaces,registerVars,inFunction,inMethod,variables));
}
break;
case IDENTIFIER:
case THIS:
case SUPER:
case ATTRIBUTE:
lexer.pushback(s);
ret=name(thisType,pkg,needsActivation,false,openedNamespaces,registerVars,inFunction,inMethod,variables,importedClasses);
allowMemberOrCall=true;
break;
default :
GraphTargetItem excmd=expressionCommands(s,registerVars,inFunction,inMethod,-1,variables);
if (excmd != null) {
ret=excmd;
allowMemberOrCall=true;
break;
}
lexer.pushback(s);
}
if (allowMemberOrCall && ret != null) {
ret=memberOrCall(thisType,pkg,needsActivation,importedClasses,openedNamespaces,ret,registerVars,inFunction,inMethod,variables);
}
if (debugMode) {
System.out.println("String_Node_Str");
}
return ret;
}