Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java

Issue 8527002: Fix to allow getters and setters (or other elements with the same name) to be uniquely identified... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SourceReferenceImpl.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java (revision 1404)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java (working copy)
@@ -142,7 +142,7 @@
DartTypeImpl typeImpl = new DartTypeImpl(compilationUnit, className);
DartTypeInfo typeInfo = new DartTypeInfo();
ArrayList<DartElementImpl> children = new ArrayList<DartElementImpl>();
- newElements.put(typeImpl, typeInfo);
+ addNewElement(typeImpl, typeInfo);
boolean constructorFound = false;
List<DartNode> members = node.getMembers();
@@ -161,7 +161,7 @@
fieldInfo.setTypeName(extractTypeName(fieldListNode.getType(), false));
fieldInfo.setModifiers(fieldNode.getModifiers());
children.add(fieldImpl);
- newElements.put(fieldImpl, fieldInfo);
+ addNewElement(fieldImpl, fieldInfo);
FunctionGatherer functionGatherer = new FunctionGatherer(fieldNode, fieldImpl,
newElements);
@@ -194,7 +194,7 @@
methodInfo.setImplicit(true);
methodInfo.setReturnTypeName(typeName.getTargetName().toCharArray());
children.add(methodImpl);
- newElements.put(methodImpl, methodInfo);
+ addNewElement(methodImpl, methodInfo);
}
}
@@ -236,7 +236,7 @@
List<DartFunctionImpl> functions = functionGatherer.getFunctions();
variableInfo.setChildren(functions.toArray(new DartElementImpl[functions.size()]));
- newElements.put(variableImpl, variableInfo);
+ addNewElement(variableImpl, variableInfo);
topLevelElements.add(variableImpl);
}
}
@@ -259,7 +259,7 @@
aliasInfo.setReturnTypeName(extractTypeName(node.getReturnTypeNode(), false));
List<DartElementImpl> parameters = getParameters(aliasImpl, node.getParameters());
aliasInfo.setChildren(parameters.toArray(new DartElementImpl[parameters.size()]));
- newElements.put(aliasImpl, aliasInfo);
+ addNewElement(aliasImpl, aliasInfo);
topLevelElements.add(aliasImpl);
return null;
}
@@ -307,7 +307,7 @@
functionInfo.setChildren(functionChildren.toArray(new DartElementImpl[functionChildren.size()]));
- newElements.put(functionImpl, functionInfo);
+ addNewElement(functionImpl, functionInfo);
topLevelElements.add(functionImpl);
return null;
}
@@ -374,7 +374,7 @@
methodInfo.setReturnTypeName(extractTypeName(methodNode.getFunction().getReturnTypeNode(),
false));
children.add(methodImpl);
- newElements.put(methodImpl, methodInfo);
+ addNewElement(methodImpl, methodInfo);
List<DartElementImpl> methodChildren = getParameters(methodImpl, methodNode.getFunction());
@@ -461,7 +461,7 @@
functionInfo.setChildren(functionChildren.toArray(new DartElementImpl[functionChildren.size()]));
- newElements.put(functionImpl, functionInfo);
+ addNewElement(functionImpl, functionInfo);
functions.add(functionImpl);
return null;
}
@@ -528,7 +528,7 @@
List<DartFunctionImpl> functions = functionGatherer.getFunctions();
variableInfo.setChildren(functions.toArray(new DartElementImpl[functions.size()]));
- newElements.put(variableImpl, variableInfo);
+ addNewElement(variableImpl, variableInfo);
variables.add(variableImpl);
}
super.visitVariableStatement(node);
@@ -555,6 +555,14 @@
this.newElements = newElements;
}
+ protected void addNewElement(SourceReferenceImpl element, DartElementInfo info) {
+ int count = 1;
+ while (newElements.containsKey(element)) {
+ element.setOccurrenceCount(++count);
+ }
+ newElements.put(element, info);
+ }
+
/**
* Create the parameters declared by the given function node.
*
@@ -601,7 +609,7 @@
List<DartFunctionImpl> functions = functionGatherer.getFunctions();
variableInfo.setChildren(functions.toArray(new DartElementImpl[functions.size()]));
- newElements.put(variableImpl, variableInfo);
+ addNewElement(variableImpl, variableInfo);
parameters.add(variableImpl);
}
return parameters;
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SourceReferenceImpl.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698