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

Side by Side Diff: pkg/compiler/lib/src/resolution/class_hierarchy.dart

Issue 1504763003: Make NamedMixinApplicationElementX and EnumClassElementX implement DeclarationSite. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/compiler/lib/src/parser/element_listener.dart ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.resolution.class_hierarchy; 5 library dart2js.resolution.class_hierarchy;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show 8 import '../common/resolution.dart' show
9 Feature; 9 Feature;
10 import '../compiler.dart' show 10 import '../compiler.dart' show
11 Compiler; 11 Compiler;
12 import '../core_types.dart' show 12 import '../core_types.dart' show
13 CoreClasses, 13 CoreClasses,
14 CoreTypes; 14 CoreTypes;
15 import '../dart_types.dart'; 15 import '../dart_types.dart';
16 import '../elements/elements.dart'; 16 import '../elements/elements.dart';
17 import '../elements/modelx.dart' show 17 import '../elements/modelx.dart' show
18 BaseClassElementX, 18 BaseClassElementX,
19 ErroneousElementX, 19 ErroneousElementX,
20 MixinApplicationElementX, 20 MixinApplicationElementX,
21 SynthesizedConstructorElementX, 21 SynthesizedConstructorElementX,
22 TypeVariableElementX; 22 TypeVariableElementX,
23 UnnamedMixinApplicationElementX;
23 import '../ordered_typeset.dart' show 24 import '../ordered_typeset.dart' show
24 OrderedTypeSet, 25 OrderedTypeSet,
25 OrderedTypeSetBuilder; 26 OrderedTypeSetBuilder;
26 import '../tree/tree.dart'; 27 import '../tree/tree.dart';
27 import '../util/util.dart' show 28 import '../util/util.dart' show
28 Link, 29 Link,
29 Setlet; 30 Setlet;
30 import '../universe/call_structure.dart' show 31 import '../universe/call_structure.dart' show
31 CallStructure; 32 CallStructure;
32 33
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 supertype = applyMixin(supertype, checkMixinType(link.head), link.head); 318 supertype = applyMixin(supertype, checkMixinType(link.head), link.head);
318 link = link.tail; 319 link = link.tail;
319 } 320 }
320 doApplyMixinTo(element, supertype, checkMixinType(link.head)); 321 doApplyMixinTo(element, supertype, checkMixinType(link.head));
321 return element.computeType(resolution); 322 return element.computeType(resolution);
322 } 323 }
323 324
324 DartType applyMixin(DartType supertype, DartType mixinType, Node node) { 325 DartType applyMixin(DartType supertype, DartType mixinType, Node node) {
325 String superName = supertype.name; 326 String superName = supertype.name;
326 String mixinName = mixinType.name; 327 String mixinName = mixinType.name;
327 MixinApplicationElementX mixinApplication = new MixinApplicationElementX( 328 MixinApplicationElementX mixinApplication =
328 "${superName}+${mixinName}", 329 new UnnamedMixinApplicationElementX(
329 element.compilationUnit, 330 "${superName}+${mixinName}",
330 compiler.getNextFreeClassId(), 331 element.compilationUnit,
331 node, 332 compiler.getNextFreeClassId(),
332 new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT)); 333 node);
333 // Create synthetic type variables for the mixin application. 334 // Create synthetic type variables for the mixin application.
334 List<DartType> typeVariables = <DartType>[]; 335 List<DartType> typeVariables = <DartType>[];
335 int index = 0; 336 int index = 0;
336 for (TypeVariableType type in element.typeVariables) { 337 for (TypeVariableType type in element.typeVariables) {
337 TypeVariableElementX typeVariableElement = new TypeVariableElementX( 338 TypeVariableElementX typeVariableElement = new TypeVariableElementX(
338 type.name, mixinApplication, index, type.element.node); 339 type.name, mixinApplication, index, type.element.node);
339 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); 340 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement);
340 typeVariables.add(typeVariable); 341 typeVariables.add(typeVariable);
341 index++; 342 index++;
342 } 343 }
(...skipping 29 matching lines...) Expand all
372 373
373 FunctionElement createForwardingConstructor(ConstructorElement target, 374 FunctionElement createForwardingConstructor(ConstructorElement target,
374 ClassElement enclosing) { 375 ClassElement enclosing) {
375 FunctionElement constructor = 376 FunctionElement constructor =
376 new SynthesizedConstructorElementX.notForDefault( 377 new SynthesizedConstructorElementX.notForDefault(
377 target.name, target, enclosing); 378 target.name, target, enclosing);
378 constructor.computeType(resolution); 379 constructor.computeType(resolution);
379 return constructor; 380 return constructor;
380 } 381 }
381 382
382 void doApplyMixinTo(MixinApplicationElementX mixinApplication, 383 void doApplyMixinTo(
383 DartType supertype, 384 MixinApplicationElementX mixinApplication,
384 DartType mixinType) { 385 DartType supertype,
386 DartType mixinType) {
385 Node node = mixinApplication.parseNode(resolution.parsing); 387 Node node = mixinApplication.parseNode(resolution.parsing);
386 388
387 if (mixinApplication.supertype != null) { 389 if (mixinApplication.supertype != null) {
388 // [supertype] is not null if there was a cycle. 390 // [supertype] is not null if there was a cycle.
389 assert(invariant(node, compiler.compilationFailed)); 391 assert(invariant(node, compiler.compilationFailed));
390 supertype = mixinApplication.supertype; 392 supertype = mixinApplication.supertype;
391 assert(invariant(node, supertype.isObject)); 393 assert(invariant(node, supertype.isObject));
392 } else { 394 } else {
393 mixinApplication.supertype = supertype; 395 mixinApplication.supertype = supertype;
394 } 396 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 if (e == null || !e.impliesType) { 720 if (e == null || !e.impliesType) {
719 reporter.reportErrorMessage( 721 reporter.reportErrorMessage(
720 node.selector, 722 node.selector,
721 MessageKind.CANNOT_RESOLVE_TYPE, 723 MessageKind.CANNOT_RESOLVE_TYPE,
722 {'typeName': node.selector}); 724 {'typeName': node.selector});
723 return; 725 return;
724 } 726 }
725 loadSupertype(e, node); 727 loadSupertype(e, node);
726 } 728 }
727 } 729 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/element_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698