Program: 85785
Project: 85785
Buggy source:
private void doSolveReferences(ASTCssNode node,IteratedScope scope){
  ExpressionEvaluator expressionEvaluator=new ExpressionEvaluator(scope.getScope(),problemsHandler);
switch (node.getType()) {
case VARIABLE:
{
      Expression replacement=expressionEvaluator.evaluate((Variable)node);
      manipulator.replace(node,replacement);
      break;
    }
case INDIRECT_VARIABLE:
{
    Expression replacement=expressionEvaluator.evaluate((IndirectVariable)node);
    manipulator.replace(node,replacement);
    break;
  }
case MIXIN_REFERENCE:
{
  MixinReference mixinReference=(MixinReference)node;
  RuleSetsBody replacement=resolveMixinReference(mixinReference,scope.getScope());
  manipulator.replaceInBody(mixinReference,replacement.getChilds());
  break;
}
case NAMESPACE_REFERENCE:
{
NamespaceReference namespaceReference=(NamespaceReference)node;
RuleSetsBody replacement=resolveNamespaceReference(namespaceReference,scope.getScope());
manipulator.replaceInBody(namespaceReference,replacement.getChilds());
break;
}
case STRING_EXPRESSION:
{
CssString replacement=replaceInString((CssString)node,expressionEvaluator);
manipulator.replace(node,replacement);
break;
}
case ESCAPED_SELECTOR:
{
EscapedSelector replacement=interpolateEscapedSelector((EscapedSelector)node,expressionEvaluator);
manipulator.replace(node,replacement);
break;
}
case ESCAPED_VALUE:
{
EscapedValue replacement=interpolateEscapedValue((EscapedValue)node,expressionEvaluator);
manipulator.replace(node,replacement);
break;
}
case FIXED_NAME_PART:
{
FixedNamePart part=(FixedNamePart)node;
FixedNamePart replacement=interpolateFixedNamePart(part,expressionEvaluator);
part.getParent().replaceMember(part,replacement);
break;
}
case VARIABLE_NAME_PART:
{
VariableNamePart part=(VariableNamePart)node;
Expression value=expressionEvaluator.evaluate(part.getVariable());
FixedNamePart fixedName=toFixedName(value,node.getUnderlyingStructure());
part.getParent().replaceMember(part,interpolateFixedNamePart(fixedName,expressionEvaluator));
break;
}
}
if (node.getType() != ASTCssNodeType.NAMESPACE_REFERENCE && node.getType() != ASTCssNodeType.VARIABLE_NAME_PART) {
List<ASTCssNode> childs=new ArrayList<ASTCssNode>(node.getChilds());
for (ASTCssNode kid : childs) {
if (AstLogic.hasOwnScope(kid)) {
doSolveReferences(kid,new IteratedScope(scope.getNextChild()));
}
 else {
doSolveReferences(kid,scope);
}
}
}
}

Fixed version (ground truth):
private void doSolveReferences(ASTCssNode node,IteratedScope scope){
  ExpressionEvaluator expressionEvaluator=new ExpressionEvaluator(scope.getScope(),problemsHandler);
switch (node.getType()) {
case VARIABLE:
{
      Expression replacement=expressionEvaluator.evaluate((Variable)node);
      manipulator.replace(node,replacement);
      break;
    }
case INDIRECT_VARIABLE:
{
    Expression replacement=expressionEvaluator.evaluate((IndirectVariable)node);
    manipulator.replace(node,replacement);
    break;
  }
case STRING_EXPRESSION:
{
  Expression replacement=expressionEvaluator.evaluate((CssString)node);
  manipulator.replace(node,replacement);
  break;
}
case ESCAPED_VALUE:
{
Expression replacement=expressionEvaluator.evaluate((EscapedValue)node);
manipulator.replace(node,replacement);
break;
}
case MIXIN_REFERENCE:
{
MixinReference mixinReference=(MixinReference)node;
RuleSetsBody replacement=resolveMixinReference(mixinReference,scope.getScope());
manipulator.replaceInBody(mixinReference,replacement.getChilds());
break;
}
case NAMESPACE_REFERENCE:
{
NamespaceReference namespaceReference=(NamespaceReference)node;
RuleSetsBody replacement=resolveNamespaceReference(namespaceReference,scope.getScope());
manipulator.replaceInBody(namespaceReference,replacement.getChilds());
break;
}
case ESCAPED_SELECTOR:
{
EscapedSelector replacement=interpolateEscapedSelector((EscapedSelector)node,expressionEvaluator);
manipulator.replace(node,replacement);
break;
}
case FIXED_NAME_PART:
{
FixedNamePart part=(FixedNamePart)node;
FixedNamePart replacement=interpolateFixedNamePart(part,expressionEvaluator);
part.getParent().replaceMember(part,replacement);
break;
}
case VARIABLE_NAME_PART:
{
VariableNamePart part=(VariableNamePart)node;
Expression value=expressionEvaluator.evaluate(part.getVariable());
FixedNamePart fixedName=toFixedName(value,node.getUnderlyingStructure());
part.getParent().replaceMember(part,interpolateFixedNamePart(fixedName,expressionEvaluator));
break;
}
}
if (node.getType() != ASTCssNodeType.NAMESPACE_REFERENCE && node.getType() != ASTCssNodeType.VARIABLE_NAME_PART) {
List<ASTCssNode> childs=new ArrayList<ASTCssNode>(node.getChilds());
for (ASTCssNode kid : childs) {
if (AstLogic.hasOwnScope(kid)) {
doSolveReferences(kid,new IteratedScope(scope.getNextChild()));
}
 else {
doSolveReferences(kid,scope);
}
}
}
}