Program: 153630
Project: 153630
Buggy source:
/** 
 * Parses an assign or a function call
 * @param getContext Flag to indicate that we need a return value.
 */
private void parseVarsAndFuncs(final boolean getContext){
  boolean first=true, stackCall=false, end=false, oop=false, append=false;
  Variable var;
  if (this.tokenizer.token == Token.RESERVED && this.tokenizer.reserved == ReservedWord.THIS) {
    final Scope s=this.scope.findFunctionScope();
    if (s == null || !s.isOop) {
      throw new WeelException(this.tokenizer.error("String_Node_Str"));
    }
    var=new Variable();
    var.type=Type.LOCAL;
    var.index=0;
  }
 else   if (this.tokenizer.token == Token.DOUBLE_COLON) {
    var=new Variable();
  }
 else {
    var=this.scope.findVariable(new Variable(),this.tokenizer.string);
  }
  ExpressionType expr=var.type != Type.NONE ? ExpressionType.VARIABLE : ExpressionType.NONE;
  if (this.tokenizer.token != Token.DOUBLE_COLON)   this.tokenizer.next();
  while (!end) {
switch (this.tokenizer.token) {
case DOUBLE_COLON:
{
        int paramc=0;
        this.tokenizer.next();
        this.checkToken(Token.NAME);
        final String name=this.tokenizer.string;
        if (expr == ExpressionType.ARRAY) {
          this.block.callRuntime("String_Node_Str");
        }
 else         if (first && expr == ExpressionType.VARIABLE) {
          this.needGetVariable(var);
          this.writeGetVariable(var);
        }
 else         if (first && var.function != null) {
          this.writeGetVariable(var);
        }
 else         if (expr != ExpressionType.FUNCTION) {
          this.syntaxError();
        }
        this.tokenizer.next();
        this.checkToken(Token.BRACE_OPEN);
        this.tokenizer.next();
        while (this.tokenizer.token != Token.BRACE_CLOSE) {
          paramc++;
          this.parseExpression();
          if (this.tokenizer.token == Token.BRACE_CLOSE) {
            break;
          }
          if (this.tokenizer.token == Token.COMMA) {
            this.tokenizer.next();
            continue;
          }
          this.syntaxError();
        }
        this.checkToken(Token.BRACE_CLOSE);
        this.tokenizer.next();
        this.block.writeSpecialCall(name,paramc,getContext || this.wouldNeedReturnValue());
        oop=first=false;
        expr=ExpressionType.FUNCTION;
        break;
      }
case BRACE_OPEN:
{
      int paramc=0;
      final boolean isAssert;
      this.tokenizer.next();
      if (first) {
        isAssert=var.name.equals("String_Node_Str");
        if (!isAssert && !var.isFunction()) {
          this.needGetVariable(var,true);
          this.writeGetVariable(var);
          stackCall=true;
        }
      }
 else {
        if (expr == ExpressionType.ARRAY) {
          if (oop) {
            this.block.callRuntime("String_Node_Str");
            paramc++;
          }
 else {
            this.block.callRuntime("String_Node_Str");
          }
          stackCall=true;
        }
        isAssert=false;
      }
      if (isAssert) {
        this.parseAssert();
        return;
      }
      while (this.tokenizer.token != Token.BRACE_CLOSE) {
        paramc++;
        this.parseExpression();
        if (this.tokenizer.token == Token.BRACE_CLOSE) {
          break;
        }
        if (this.tokenizer.token == Token.COMMA) {
          this.tokenizer.next();
          continue;
        }
        this.syntaxError();
      }
      this.checkToken(Token.BRACE_CLOSE);
      this.tokenizer.next();
      if (first && !stackCall) {
        WeelFunction func=this.weel.findFunction(var.name,paramc);
        if (func == null) {
          throw new WeelException(this.tokenizer.error("String_Node_Str" + var.name + "String_Node_Str"+ paramc+ "String_Node_Str"));
        }
        this.writeCallFunction(func);
        if (getContext || this.wouldNeedReturnValue()) {
          if (!func.returnsValue) {
            throw new WeelException(this.tokenizer.error("String_Node_Str" + func.name + "String_Node_Str"+ func.arguments+ "String_Node_Str"));
          }
        }
 else {
          if (func.returnsValue) {
            this.block.callRuntime("String_Node_Str");
          }
        }
      }
 else {
        this.block.doStackcall(paramc,getContext | this.wouldNeedReturnValue());
      }
      oop=first=false;
      expr=ExpressionType.FUNCTION;
      break;
    }
case ARROW:
  if (first) {
    this.needGetVariable(var);
    this.writeGetVariable(var);
  }
 else {
    if (expr == ExpressionType.ARRAY)     this.block.callRuntime("String_Node_Str");
  }
this.tokenizer.next();
this.checkToken(Token.NAME);
this.block.load(this.tokenizer.string);
this.tokenizer.next();
oop=true;
first=false;
expr=ExpressionType.ARRAY;
break;
case DOT:
if (first) {
this.needGetVariable(var);
this.writeGetVariable(var);
}
 else {
if (expr == ExpressionType.ARRAY) this.block.callRuntime("String_Node_Str");
}
this.tokenizer.next();
this.checkToken(Token.NAME);
this.block.load(this.tokenizer.string);
this.tokenizer.next();
oop=first=false;
expr=ExpressionType.ARRAY;
break;
case BRACKET_OPEN:
if (first) {
this.needGetVariable(var);
this.writeGetVariable(var);
}
 else {
if (expr == ExpressionType.ARRAY) this.block.callRuntime("String_Node_Str");
}
this.tokenizer.next();
if (!getContext && this.tokenizer.token == Token.BRACKET_CLOSE) {
this.tokenizer.next();
if (this.tokenizer.token != Token.ASSIGN) this.syntaxError();
append=true;
}
 else {
this.parseExpression();
this.checkToken(Token.BRACKET_CLOSE);
this.tokenizer.next();
}
oop=first=false;
expr=ExpressionType.ARRAY;
break;
case ASSIGN_ADD:
case ASSIGN_DIV:
case ASSIGN_AND:
case ASSIGN_MODULO:
case ASSIGN_MUL:
case ASSIGN_OR:
case ASSIGN_SUB:
case ASSIGN_XOR:
case ASSIGN_STRCAT:
if (first) {
this.needGetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
case ASSIGN:
if (first) {
this.needSetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
default :
if (!getContext && first && var.type == Type.NONE) {
this.syntaxError();
}
 else if (getContext && first) {
if (!var.isFunction()) this.needGetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
}
}
switch (this.tokenizer.token) {
case ASSIGN_ADD:
case ASSIGN_DIV:
case ASSIGN_AND:
case ASSIGN_MODULO:
case ASSIGN_MUL:
case ASSIGN_OR:
case ASSIGN_SUB:
case ASSIGN_XOR:
case ASSIGN_STRCAT:
{
final Token op=this.tokenizer.token;
if (first && expr != ExpressionType.ARRAY && var.type == Type.NONE) this.syntaxError();
if (expr == ExpressionType.ARRAY) {
this.block.callRuntime("String_Node_Str");
this.block.callRuntime("String_Node_Str");
}
 else {
this.writeGetVariable(var);
}
this.tokenizer.next();
this.parseExpression();
switch (op) {
case ASSIGN_ADD:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_DIV:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_AND:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_MODULO:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_MUL:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_OR:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_SUB:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_XOR:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_STRCAT:
this.block.callRuntime("String_Node_Str");
break;
default :
break;
}
if (expr == ExpressionType.ARRAY) {
if (getContext) this.block.callRuntime("String_Node_Str");
this.block.callRuntime("String_Node_Str");
}
 else {
if (getContext) this.block.callRuntime("String_Node_Str");
this.writeSetVariable(var);
}
break;
}
case ASSIGN:
this.tokenizer.next();
this.parseExpression();
if (expr == ExpressionType.ARRAY) {
if (getContext) this.block.callRuntime("String_Node_Str");
if (append) this.block.callRuntime("String_Node_Str");
 else this.block.callRuntime("String_Node_Str");
}
 else if (expr == ExpressionType.VARIABLE) {
if (getContext) this.block.callRuntime("String_Node_Str");
this.writeSetVariable(var);
}
 else {
this.syntaxError();
}
break;
default :
if (first && getContext && (var.type != Type.NONE || var.function != null)) {
this.writeGetVariable(var);
}
 else if (getContext && expr == ExpressionType.ARRAY) {
this.block.callRuntime("String_Node_Str");
}
 else if (expr != ExpressionType.FUNCTION) {
if (getContext && first) {
throw new WeelException(this.tokenizer.error("String_Node_Str",var.name));
}
this.syntaxError();
}
break;
}
}

Fixed version (ground truth):
/** 
 * Parses an assign or a function call
 * @param getContext Flag to indicate that we need a return value.
 */
private void parseVarsAndFuncs(final boolean getContext){
  boolean first=true, stackCall=false, end=false, oop=false, append=false;
  Variable var;
  if (this.tokenizer.token == Token.RESERVED && this.tokenizer.reserved == ReservedWord.THIS) {
    final Scope s=this.scope.findFunctionScope();
    if (s == null || !s.isOop) {
      throw new WeelException(this.tokenizer.error("String_Node_Str"));
    }
    var=new Variable();
    var.type=Type.LOCAL;
    var.index=0;
  }
 else   if (this.tokenizer.token == Token.DOUBLE_COLON) {
    var=new Variable();
  }
 else {
    var=this.scope.findVariable(new Variable(),this.tokenizer.string);
  }
  ExpressionType expr=var.type != Type.NONE ? ExpressionType.VARIABLE : ExpressionType.NONE;
  if (this.tokenizer.token != Token.DOUBLE_COLON)   this.tokenizer.next();
  while (!end) {
switch (this.tokenizer.token) {
case DOUBLE_COLON:
{
        int paramc=0;
        this.tokenizer.next();
        this.checkToken(Token.NAME);
        final String name=this.tokenizer.string;
        if (expr == ExpressionType.ARRAY) {
          this.block.callRuntime("String_Node_Str");
        }
 else         if (first && expr == ExpressionType.VARIABLE) {
          this.needGetVariable(var);
          this.writeGetVariable(var);
        }
 else         if (first && var.function != null) {
          this.writeGetVariable(var);
        }
 else         if (expr != ExpressionType.FUNCTION) {
          this.syntaxError();
        }
        this.tokenizer.next();
        this.checkToken(Token.BRACE_OPEN);
        this.tokenizer.next();
        while (this.tokenizer.token != Token.BRACE_CLOSE) {
          paramc++;
          this.parseExpression();
          if (this.tokenizer.token == Token.BRACE_CLOSE) {
            break;
          }
          if (this.tokenizer.token == Token.COMMA) {
            this.tokenizer.next();
            continue;
          }
          this.syntaxError();
        }
        this.checkToken(Token.BRACE_CLOSE);
        this.tokenizer.next();
        this.block.writeSpecialCall(name,paramc,getContext || this.wouldNeedReturnValue());
        oop=first=false;
        expr=ExpressionType.FUNCTION;
        break;
      }
case BRACE_OPEN:
{
      int paramc=0;
      final boolean isAssert;
      this.tokenizer.next();
      if (first) {
        isAssert=var.name.equals("String_Node_Str");
        if (!isAssert && !var.isFunction()) {
          this.needGetVariable(var,true);
          this.writeGetVariable(var);
          stackCall=true;
        }
      }
 else {
        if (expr == ExpressionType.ARRAY) {
          if (oop) {
            this.block.callRuntime("String_Node_Str");
            paramc++;
          }
 else {
            this.block.callRuntime("String_Node_Str");
          }
          stackCall=true;
        }
        isAssert=false;
      }
      if (isAssert) {
        this.parseAssert();
        return;
      }
      while (this.tokenizer.token != Token.BRACE_CLOSE) {
        paramc++;
        this.parseExpression();
        if (this.tokenizer.token == Token.BRACE_CLOSE) {
          break;
        }
        if (this.tokenizer.token == Token.COMMA) {
          this.tokenizer.next();
          continue;
        }
        this.syntaxError();
      }
      this.checkToken(Token.BRACE_CLOSE);
      this.tokenizer.next();
      if (first && !stackCall) {
        WeelFunction func=this.weel.findFunction(var.name,paramc);
        if (func == null) {
          throw new WeelException(this.tokenizer.error("String_Node_Str" + var.name + "String_Node_Str"+ paramc+ "String_Node_Str"));
        }
        this.writeCallFunction(func);
        if (getContext || this.wouldNeedReturnValue()) {
          if (!func.returnsValue) {
            throw new WeelException(this.tokenizer.error("String_Node_Str" + func.name + "String_Node_Str"+ func.arguments+ "String_Node_Str"));
          }
        }
 else {
          if (func.returnsValue) {
            this.block.callRuntime("String_Node_Str");
          }
        }
      }
 else {
        this.block.doStackcall(paramc,getContext | this.wouldNeedReturnValue());
      }
      oop=first=false;
      expr=ExpressionType.FUNCTION;
      break;
    }
case ARROW:
  if (first) {
    this.needGetVariable(var);
    this.writeGetVariable(var);
  }
 else {
    if (expr == ExpressionType.ARRAY)     this.block.callRuntime("String_Node_Str");
  }
this.tokenizer.next();
this.checkToken(Token.NAME);
this.block.load(this.tokenizer.string);
this.tokenizer.next();
oop=true;
first=false;
expr=ExpressionType.ARRAY;
break;
case DOT:
if (first) {
this.needGetVariable(var);
this.writeGetVariable(var);
}
 else {
if (expr == ExpressionType.ARRAY) this.block.callRuntime("String_Node_Str");
}
this.tokenizer.next();
this.checkToken(Token.NAME);
this.block.load(this.tokenizer.string);
this.tokenizer.next();
oop=first=false;
expr=ExpressionType.ARRAY;
break;
case BRACKET_OPEN:
if (first) {
this.needGetVariable(var);
this.writeGetVariable(var);
}
 else {
if (expr == ExpressionType.ARRAY) this.block.callRuntime("String_Node_Str");
}
this.tokenizer.next();
if (!getContext && this.tokenizer.token == Token.BRACKET_CLOSE) {
this.tokenizer.next();
if (this.tokenizer.token != Token.ASSIGN) this.syntaxError();
append=true;
}
 else {
this.parseExpression();
this.checkToken(Token.BRACKET_CLOSE);
this.tokenizer.next();
}
oop=first=false;
expr=ExpressionType.ARRAY;
break;
case ASSIGN_ADD:
case ASSIGN_DIV:
case ASSIGN_AND:
case ASSIGN_MODULO:
case ASSIGN_MUL:
case ASSIGN_OR:
case ASSIGN_SUB:
case ASSIGN_XOR:
case ASSIGN_STRCAT:
case ASSIGN_MAPCAT:
if (first) {
this.needGetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
case ASSIGN:
if (first) {
this.needSetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
default :
if (!getContext && first && var.type == Type.NONE) {
this.syntaxError();
}
 else if (getContext && first) {
if (!var.isFunction()) this.needGetVariable(var);
expr=ExpressionType.VARIABLE;
}
end=true;
break;
}
}
switch (this.tokenizer.token) {
case ASSIGN_ADD:
case ASSIGN_DIV:
case ASSIGN_AND:
case ASSIGN_MODULO:
case ASSIGN_MUL:
case ASSIGN_OR:
case ASSIGN_SUB:
case ASSIGN_XOR:
case ASSIGN_STRCAT:
case ASSIGN_MAPCAT:
{
final Token op=this.tokenizer.token;
if (first && expr != ExpressionType.ARRAY && var.type == Type.NONE) this.syntaxError();
if (expr == ExpressionType.ARRAY) {
this.block.callRuntime("String_Node_Str");
this.block.callRuntime("String_Node_Str");
}
 else {
this.writeGetVariable(var);
}
this.tokenizer.next();
this.parseExpression();
switch (op) {
case ASSIGN_ADD:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_DIV:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_AND:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_MODULO:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_MUL:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_OR:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_SUB:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_XOR:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_STRCAT:
this.block.callRuntime("String_Node_Str");
break;
case ASSIGN_MAPCAT:
this.block.callRuntime("String_Node_Str");
break;
default :
break;
}
if (expr == ExpressionType.ARRAY) {
if (getContext) this.block.callRuntime("String_Node_Str");
this.block.callRuntime("String_Node_Str");
}
 else {
if (getContext) this.block.callRuntime("String_Node_Str");
this.writeSetVariable(var);
}
break;
}
case ASSIGN:
this.tokenizer.next();
this.parseExpression();
if (expr == ExpressionType.ARRAY) {
if (getContext) this.block.callRuntime("String_Node_Str");
if (append) this.block.callRuntime("String_Node_Str");
 else this.block.callRuntime("String_Node_Str");
}
 else if (expr == ExpressionType.VARIABLE) {
if (getContext) this.block.callRuntime("String_Node_Str");
this.writeSetVariable(var);
}
 else {
this.syntaxError();
}
break;
default :
if (first && getContext && (var.type != Type.NONE || var.function != null)) {
this.writeGetVariable(var);
}
 else if (getContext && expr == ExpressionType.ARRAY) {
this.block.callRuntime("String_Node_Str");
}
 else if (expr != ExpressionType.FUNCTION) {
if (getContext && first) {
throw new WeelException(this.tokenizer.error("String_Node_Str",var.name));
}
this.syntaxError();
}
break;
}
}