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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 import '../tree/tree.dart'; | 46 import '../tree/tree.dart'; |
47 import '../universe/call_structure.dart' show CallStructure; | 47 import '../universe/call_structure.dart' show CallStructure; |
48 import '../universe/use.dart' show StaticUse, TypeUse; | 48 import '../universe/use.dart' show StaticUse, TypeUse; |
49 import '../universe/world_impact.dart' show WorldImpact; | 49 import '../universe/world_impact.dart' show WorldImpact; |
50 import '../util/util.dart' show Link, Setlet; | 50 import '../util/util.dart' show Link, Setlet; |
51 import 'class_hierarchy.dart'; | 51 import 'class_hierarchy.dart'; |
52 import 'class_members.dart' show MembersCreator; | 52 import 'class_members.dart' show MembersCreator; |
53 import 'constructors.dart'; | 53 import 'constructors.dart'; |
54 import 'members.dart'; | 54 import 'members.dart'; |
55 import 'registry.dart'; | 55 import 'registry.dart'; |
| 56 import 'scope.dart' show MutableScope; |
56 import 'signatures.dart'; | 57 import 'signatures.dart'; |
57 import 'tree_elements.dart'; | 58 import 'tree_elements.dart'; |
58 import 'typedefs.dart'; | 59 import 'typedefs.dart'; |
59 | 60 |
60 class ResolverTask extends CompilerTask { | 61 class ResolverTask extends CompilerTask { |
61 final ConstantCompiler constantCompiler; | 62 final ConstantCompiler constantCompiler; |
62 final Compiler compiler; | 63 final Compiler compiler; |
63 | 64 |
64 ResolverTask(Compiler compiler, this.constantCompiler) | 65 ResolverTask(Compiler compiler, this.constantCompiler) |
65 : compiler = compiler, | 66 : compiler = compiler, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY); | 230 tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY); |
230 } else if (!tree.isRedirectingFactory) { | 231 } else if (!tree.isRedirectingFactory) { |
231 reporter.reportErrorMessage(tree, MessageKind.CONST_FACTORY); | 232 reporter.reportErrorMessage(tree, MessageKind.CONST_FACTORY); |
232 } | 233 } |
233 } | 234 } |
234 } | 235 } |
235 | 236 |
236 ResolverVisitor visitor = visitorFor(element); | 237 ResolverVisitor visitor = visitorFor(element); |
237 ResolutionRegistry registry = visitor.registry; | 238 ResolutionRegistry registry = visitor.registry; |
238 registry.defineFunction(tree, element); | 239 registry.defineFunction(tree, element); |
239 visitor.setupFunction(tree, element); | 240 visitor.setupFunction(tree, element); // Modifies the scope. |
240 processAsyncMarker(compiler, element, registry); | 241 processAsyncMarker(compiler, element, registry); |
241 | 242 |
242 if (element.isGenerativeConstructor) { | 243 if (element.isGenerativeConstructor) { |
243 // Even if there is no initializer list we still have to do the | 244 // Even if there is no initializer list we still have to do the |
244 // resolution in case there is an implicit super constructor call. | 245 // resolution in case there is an implicit super constructor call. |
245 InitializerResolver resolver = | 246 InitializerResolver resolver = |
246 new InitializerResolver(visitor, element, tree); | 247 new InitializerResolver(visitor, element, tree); |
247 FunctionElement redirection = resolver.resolveInitializers(); | 248 FunctionElement redirection = resolver.resolveInitializers( |
| 249 enableInitializingFormalAccess: |
| 250 compiler.options.enableInitializingFormalAccess); |
248 if (redirection != null) { | 251 if (redirection != null) { |
249 resolveRedirectingConstructor(resolver, tree, element, redirection); | 252 resolveRedirectingConstructor(resolver, tree, element, redirection); |
250 } | 253 } |
251 } else if (tree.initializers != null) { | 254 } else if (tree.initializers != null) { |
252 reporter.reportErrorMessage( | 255 reporter.reportErrorMessage( |
253 tree, MessageKind.FUNCTION_WITH_INITIALIZER); | 256 tree, MessageKind.FUNCTION_WITH_INITIALIZER); |
254 } | 257 } |
255 | 258 |
256 if (!compiler.options.analyzeSignaturesOnly || | 259 if (!compiler.options.analyzeSignaturesOnly || |
257 tree.isRedirectingFactory) { | 260 tree.isRedirectingFactory) { |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 TreeElements get treeElements { | 1123 TreeElements get treeElements { |
1121 assert(invariant(this, _treeElements != null, | 1124 assert(invariant(this, _treeElements != null, |
1122 message: "TreeElements have not been computed for $this.")); | 1125 message: "TreeElements have not been computed for $this.")); |
1123 return _treeElements; | 1126 return _treeElements; |
1124 } | 1127 } |
1125 | 1128 |
1126 void reuseElement() { | 1129 void reuseElement() { |
1127 _treeElements = null; | 1130 _treeElements = null; |
1128 } | 1131 } |
1129 } | 1132 } |
OLD | NEW |