OLD | NEW |
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 library dart2js.resolution; | 5 library dart2js.resolution; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 29 matching lines...) Expand all Loading... |
40 import '../tokens/token.dart' | 40 import '../tokens/token.dart' |
41 show | 41 show |
42 isBinaryOperator, | 42 isBinaryOperator, |
43 isMinusOperator, | 43 isMinusOperator, |
44 isTernaryOperator, | 44 isTernaryOperator, |
45 isUnaryOperator, | 45 isUnaryOperator, |
46 isUserDefinableOperator; | 46 isUserDefinableOperator; |
47 import '../tree/tree.dart'; | 47 import '../tree/tree.dart'; |
48 import '../universe/call_structure.dart' show CallStructure; | 48 import '../universe/call_structure.dart' show CallStructure; |
49 import '../universe/feature.dart' show Feature; | 49 import '../universe/feature.dart' show Feature; |
50 import '../universe/use.dart' show StaticUse, TypeUse; | 50 import '../universe/use.dart' show StaticUse; |
51 import '../universe/world_impact.dart' show WorldImpact; | 51 import '../universe/world_impact.dart' show WorldImpact; |
52 import '../util/util.dart' show Link, Setlet; | 52 import '../util/util.dart' show Link, Setlet; |
53 import '../world.dart'; | 53 import '../world.dart'; |
54 import 'class_hierarchy.dart'; | 54 import 'class_hierarchy.dart'; |
55 import 'class_members.dart' show MembersCreator; | 55 import 'class_members.dart' show MembersCreator; |
56 import 'constructors.dart'; | 56 import 'constructors.dart'; |
57 import 'members.dart'; | 57 import 'members.dart'; |
58 import 'registry.dart'; | 58 import 'registry.dart'; |
59 import 'resolution_result.dart'; | 59 import 'resolution_result.dart'; |
60 import 'signatures.dart'; | 60 import 'signatures.dart'; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // [target] is now the actual target of the redirections. Run through | 509 // [target] is now the actual target of the redirections. Run through |
510 // the constructors again and set their [redirectionTarget], so that we | 510 // the constructors again and set their [redirectionTarget], so that we |
511 // do not have to run the loop for these constructors again. Furthermore, | 511 // do not have to run the loop for these constructors again. Furthermore, |
512 // compute [redirectionTargetType] for each factory by computing the | 512 // compute [redirectionTargetType] for each factory by computing the |
513 // substitution of the target type with respect to the factory type. | 513 // substitution of the target type with respect to the factory type. |
514 while (!seen.isEmpty) { | 514 while (!seen.isEmpty) { |
515 ConstructorElementX factory = seen.removeLast(); | 515 ConstructorElementX factory = seen.removeLast(); |
516 ResolvedAst resolvedAst = factory.resolvedAst; | 516 ResolvedAst resolvedAst = factory.resolvedAst; |
517 assert(invariant(node, resolvedAst != null, | 517 assert(invariant(node, resolvedAst != null, |
518 message: 'No ResolvedAst for $factory.')); | 518 message: 'No ResolvedAst for $factory.')); |
519 FunctionExpression functionNode = resolvedAst.node; | |
520 RedirectingFactoryBody redirectionNode = resolvedAst.body; | 519 RedirectingFactoryBody redirectionNode = resolvedAst.body; |
521 ResolutionDartType factoryType = | 520 ResolutionDartType factoryType = |
522 resolvedAst.elements.getType(redirectionNode); | 521 resolvedAst.elements.getType(redirectionNode); |
523 if (!factoryType.isDynamic) { | 522 if (!factoryType.isDynamic) { |
524 targetType = targetType.substByContext(factoryType); | 523 targetType = targetType.substByContext(factoryType); |
525 } | 524 } |
526 factory.setEffectiveTarget(target, targetType, isMalformed: isMalformed); | 525 factory.setEffectiveTarget(target, targetType, isMalformed: isMalformed); |
527 } | 526 } |
528 } | 527 } |
529 | 528 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 TreeElements get treeElements { | 1137 TreeElements get treeElements { |
1139 assert(invariant(this, _treeElements != null, | 1138 assert(invariant(this, _treeElements != null, |
1140 message: "TreeElements have not been computed for $this.")); | 1139 message: "TreeElements have not been computed for $this.")); |
1141 return _treeElements; | 1140 return _treeElements; |
1142 } | 1141 } |
1143 | 1142 |
1144 void reuseElement() { | 1143 void reuseElement() { |
1145 _treeElements = null; | 1144 _treeElements = null; |
1146 } | 1145 } |
1147 } | 1146 } |
OLD | NEW |