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

Issue 9692002: Step back and remove more getNode() invocations (Closed)

Created:
8 years, 9 months ago by scheglov
Modified:
8 years, 9 months ago
Reviewers:
Brian Wilkerson, zundel
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Step back and remove more getNode() invocations In many cases we need Element.getNode() only for producing error. This CL changes these places and well as other places where we can easily use only Elements without getNode(). R=zundel@google.com,brianwilkerson@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=5349

Patch Set 1 #

Total comments: 19
Unified diffs Side-by-side diffs Delta from patch set Stats (+694 lines, -550 lines) Patch
M compiler/java/com/google/dart/compiler/DartCompiler.java View 2 chunks +4 lines, -4 lines 0 comments Download
M compiler/java/com/google/dart/compiler/DeltaAnalyzer.java View 1 chunk +1 line, -1 line 0 comments Download
M compiler/java/com/google/dart/compiler/LibraryDepsVisitor.java View 4 chunks +12 lines, -14 lines 2 comments Download
M compiler/java/com/google/dart/compiler/common/AbstractNode.java View 1 chunk +4 lines, -4 lines 0 comments Download
M compiler/java/com/google/dart/compiler/common/HasSourceInfo.java View 1 chunk +0 lines, -5 lines 0 comments Download
A + compiler/java/com/google/dart/compiler/common/HasSourceInfoSetter.java View 1 chunk +3 lines, -9 lines 0 comments Download
M compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java View 2 chunks +3 lines, -2 lines 2 comments Download
M compiler/java/com/google/dart/compiler/resolver/AbstractElement.java View 3 chunks +16 lines, -9 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ClassElement.java View 1 chunk +6 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java View 5 chunks +18 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ConstructorElement.java View 1 chunk +4 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.java View 4 chunks +25 lines, -12 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/DynamicElementImplementation.java View 5 chunks +20 lines, -4 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Element.java View 2 chunks +10 lines, -6 lines 4 comments Download
M compiler/java/com/google/dart/compiler/resolver/ElementMap.java View 5 chunks +17 lines, -10 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Elements.java View 12 chunks +67 lines, -122 lines 2 comments Download
M compiler/java/com/google/dart/compiler/resolver/FieldElementImplementation.java View 3 chunks +25 lines, -11 lines 1 comment Download
M compiler/java/com/google/dart/compiler/resolver/LabelElementImplementation.java View 1 chunk +0 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java View 7 chunks +28 lines, -9 lines 2 comments Download
M compiler/java/com/google/dart/compiler/resolver/MethodElement.java View 1 chunk +2 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.java View 4 chunks +31 lines, -18 lines 4 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java View 4 chunks +15 lines, -9 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolutionErrorListener.java View 1 chunk +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java View 4 chunks +17 lines, -8 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Resolver.java View 27 chunks +55 lines, -40 lines 2 comments Download
M compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java View 1 chunk +1 line, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java View 6 chunks +19 lines, -35 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java View 2 chunks +4 lines, -8 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/TypeVariableElement.java View 1 chunk +0 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/TypeVariableElementImplementation.java View 5 chunks +27 lines, -11 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/VariableElementImplementation.java View 3 chunks +23 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 6 chunks +7 lines, -7 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/IdeTest.java View 11 chunks +96 lines, -71 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ElementMapTest.java View 2 chunks +7 lines, -2 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java View 2 chunks +13 lines, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java View 16 chunks +59 lines, -36 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java View 1 chunk +10 lines, -0 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java View 3 chunks +8 lines, -9 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTestCase.java View 3 chunks +6 lines, -3 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeTestCase.java View 1 chunk +1 line, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/completion/CompletionEngine.java View 6 chunks +5 lines, -10 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java View 3 chunks +7 lines, -18 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/util/ElementFactory.java View 4 chunks +4 lines, -4 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/indexer/contributor/DartContributor.java View 3 chunks +3 lines, -9 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/indexer/contributor/MethodOverrideContributor.java View 2 chunks +1 line, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/SourceRangeImpl.java View 2 chunks +2 lines, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java View 6 chunks +5 lines, -6 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
scheglov
8 years, 9 months ago (2012-03-12 18:23:22 UTC) #1
Brian Wilkerson
LGTM https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/Elements.java File compiler/java/com/google/dart/compiler/resolver/Elements.java (right): https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/Elements.java#newcode444 compiler/java/com/google/dart/compiler/resolver/Elements.java:444: public static SourceInfo getNameLocation(Element element) { In a ...
8 years, 9 months ago (2012-03-12 19:09:26 UTC) #2
scheglov
https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.java File compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.java (right): https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.java#newcode51 compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.java:51: // TODO(jgw): Pass in modifiers directly, not referencing node. ...
8 years, 9 months ago (2012-03-12 19:36:24 UTC) #3
zundel
Well, I still haven't had a time to look at it all but its already ...
8 years, 9 months ago (2012-03-12 19:42:31 UTC) #4
zundel
https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/FieldElementImplementation.java File compiler/java/com/google/dart/compiler/resolver/FieldElementImplementation.java (right): https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/google/dart/compiler/resolver/FieldElementImplementation.java#newcode12 compiler/java/com/google/dart/compiler/resolver/FieldElementImplementation.java:12: import com.google.dart.compiler.common.SourceInfo; If its just a couple of files, ...
8 years, 9 months ago (2012-03-12 20:05:57 UTC) #5
scheglov
Eric, thank you for comments. I will integrate them into the next CL. I know ...
8 years, 9 months ago (2012-03-12 20:24:58 UTC) #6
scheglov
8 years, 9 months ago (2012-03-13 00:42:25 UTC) #7
https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/LibraryDepsVisitor.java (right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/LibraryDepsVisitor.java:48: Element
enclosing = target.getEnclosingElement();
On 2012/03/12 19:42:31, zundel wrote:
> Why the removal of EnclosingElement everywhere?  You have removed many
> references to it but it still exists in the class hierarchy.  Part of the JDK6
> bug?

Because I've tried to make "enclosingElement" just "parentElement".
For example for VariableElement the MethodElement is "enclosing", but are we
going to track all local variables which exist in method and return them from
getMembers()?

Hm...
Looks that you are right, we can make getEnclosingElement() always return
EnclosingElement.
I will fix this.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java
(right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java:98:
if (result instanceof HasSourceInfo) {
On 2012/03/12 19:42:31, zundel wrote:
> instanceof HasSourceInfoSetter?

Done.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/resolver/Element.java (right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/resolver/Element.java:31: Element
getEnclosingElement();
On 2012/03/12 19:42:31, zundel wrote:
> I don't understand this change.  The EnclosingElement says something about the
> scope.

I will undo this in the next CL.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/resolver/Element.java:36: SourceInfo
getNameLocation();
On 2012/03/12 19:42:31, zundel wrote:
> We will need to be careful about persisting this field.  There is that static
> weak hash map we must make sure is repopulated.

This map is populated lazily.
Basically we will serialize SourceInfo as resource identifier, offset and
length.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/resolver/Elements.java (right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/resolver/Elements.java:444: public static
SourceInfo getNameLocation(Element element) {
On 2012/03/12 19:09:26, Brian Wilkerson wrote:
> In a subsequent CL this method should go away.

Done.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java (right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java:62: private
Element enclosingElement;
On 2012/03/12 20:05:57, zundel wrote:
> This should be EnclosingElement just as a way of enforcing type safety. There
> are only a few types that are valid enclosing elements for fields and method
> definitions.

Done.

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right):

https://chromiumcodereview.appspot.com/9692002/diff/1/compiler/java/com/googl...
compiler/java/com/google/dart/compiler/resolver/Resolver.java:395: //String
defaultClassSource = getTypeDraftSourceString(defaultClassType);
On 2012/03/12 20:05:57, zundel wrote:
> remove commented out code?

Done.

Powered by Google App Engine
This is Rietveld 408576698