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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 19469003: Do not use the NamedMixinApplication node for anonymous mixins: otherwise, the [MixinApplicationEle… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 resolveTypeVariableBounds(node.typeParameters); 3245 resolveTypeVariableBounds(node.typeParameters);
3246 3246
3247 // Setup the supertype for the element (if there is a cycle in the 3247 // Setup the supertype for the element (if there is a cycle in the
3248 // class hierarchy, it has already been set to Object). 3248 // class hierarchy, it has already been set to Object).
3249 if (element.supertype == null && node.superclass != null) { 3249 if (element.supertype == null && node.superclass != null) {
3250 MixinApplication superMixin = node.superclass.asMixinApplication(); 3250 MixinApplication superMixin = node.superclass.asMixinApplication();
3251 if (superMixin != null) { 3251 if (superMixin != null) {
3252 DartType supertype = resolveSupertype(element, superMixin.superclass); 3252 DartType supertype = resolveSupertype(element, superMixin.superclass);
3253 Link<Node> link = superMixin.mixins.nodes; 3253 Link<Node> link = superMixin.mixins.nodes;
3254 while (!link.isEmpty) { 3254 while (!link.isEmpty) {
3255 supertype = applyMixin(supertype, resolveType(link.head)); 3255 supertype = applyMixin(supertype, resolveType(link.head), node);
3256 link = link.tail; 3256 link = link.tail;
3257 } 3257 }
3258 element.supertype = supertype; 3258 element.supertype = supertype;
3259 } else { 3259 } else {
3260 element.supertype = resolveSupertype(element, node.superclass); 3260 element.supertype = resolveSupertype(element, node.superclass);
3261 } 3261 }
3262 } 3262 }
3263 // If the super type isn't specified, we provide a default. The language 3263 // If the super type isn't specified, we provide a default. The language
3264 // specifies [Object] but the backend can pick a specific 'implementation' 3264 // specifies [Object] but the backend can pick a specific 'implementation'
3265 // of Object - the JavaScript backend chooses between Object and 3265 // of Object - the JavaScript backend chooses between Object and
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 3307
3308 InterfaceType type = element.computeType(compiler); 3308 InterfaceType type = element.computeType(compiler);
3309 scope = new TypeDeclarationScope(scope, element); 3309 scope = new TypeDeclarationScope(scope, element);
3310 resolveTypeVariableBounds(node.typeParameters); 3310 resolveTypeVariableBounds(node.typeParameters);
3311 3311
3312 // Generate anonymous mixin application elements for the 3312 // Generate anonymous mixin application elements for the
3313 // intermediate mixin applications (excluding the last). 3313 // intermediate mixin applications (excluding the last).
3314 DartType supertype = resolveSupertype(element, node.superclass); 3314 DartType supertype = resolveSupertype(element, node.superclass);
3315 Link<Node> link = node.mixins.nodes; 3315 Link<Node> link = node.mixins.nodes;
3316 while (!link.tail.isEmpty) { 3316 while (!link.tail.isEmpty) {
3317 supertype = applyMixin(supertype, resolveType(link.head)); 3317 supertype = applyMixin(supertype, resolveType(link.head), link.head);
3318 link = link.tail; 3318 link = link.tail;
3319 } 3319 }
3320 doApplyMixinTo(element, supertype, resolveType(link.head)); 3320 doApplyMixinTo(element, supertype, resolveType(link.head));
3321 return element.computeType(compiler); 3321 return element.computeType(compiler);
3322 } 3322 }
3323 3323
3324 DartType applyMixin(DartType supertype, DartType mixinType) { 3324 DartType applyMixin(DartType supertype, DartType mixinType, Node node) {
3325 String superName = supertype.name.slowToString(); 3325 String superName = supertype.name.slowToString();
3326 String mixinName = mixinType.name.slowToString(); 3326 String mixinName = mixinType.name.slowToString();
3327 ClassElement mixinApplication = new MixinApplicationElementX( 3327 ClassElement mixinApplication = new MixinApplicationElementX(
3328 new SourceString("${superName}_${mixinName}"), 3328 new SourceString("${superName}_${mixinName}"),
3329 element.getCompilationUnit(), 3329 element.getCompilationUnit(),
3330 compiler.getNextFreeClassId(), 3330 compiler.getNextFreeClassId(),
3331 element.parseNode(compiler), 3331 node,
3332 Modifiers.EMPTY); // TODO(kasperl): Should this be abstract? 3332 Modifiers.EMPTY); // TODO(kasperl): Should this be abstract?
3333 doApplyMixinTo(mixinApplication, supertype, mixinType); 3333 doApplyMixinTo(mixinApplication, supertype, mixinType);
3334 mixinApplication.resolutionState = STATE_DONE; 3334 mixinApplication.resolutionState = STATE_DONE;
3335 mixinApplication.supertypeLoadState = STATE_DONE; 3335 mixinApplication.supertypeLoadState = STATE_DONE;
3336 return mixinApplication.computeType(compiler); 3336 return mixinApplication.computeType(compiler);
3337 } 3337 }
3338 3338
3339 bool isDefaultConstructor(FunctionElement constructor) { 3339 bool isDefaultConstructor(FunctionElement constructor) {
3340 return constructor.name == const SourceString('') && 3340 return constructor.name == const SourceString('') &&
3341 constructor.computeSignature(compiler).parameterCount == 0; 3341 constructor.computeSignature(compiler).parameterCount == 0;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 return e; 4070 return e;
4071 } 4071 }
4072 4072
4073 /// Assumed to be called by [resolveRedirectingFactory]. 4073 /// Assumed to be called by [resolveRedirectingFactory].
4074 Element visitReturn(Return node) { 4074 Element visitReturn(Return node) {
4075 Node expression = node.expression; 4075 Node expression = node.expression;
4076 return finishConstructorReference(visit(expression), 4076 return finishConstructorReference(visit(expression),
4077 expression, expression); 4077 expression, expression);
4078 } 4078 }
4079 } 4079 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698