| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
| 9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
| 10 | 10 |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER); | 707 compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER); |
| 708 } else if (modifiers.isFinal && !element.isInstanceMember) { | 708 } else if (modifiers.isFinal && !element.isInstanceMember) { |
| 709 compiler.reportError(element, MessageKind.FINAL_WITHOUT_INITIALIZER); | 709 compiler.reportError(element, MessageKind.FINAL_WITHOUT_INITIALIZER); |
| 710 } else { | 710 } else { |
| 711 registry.registerInstantiatedClass(compiler.nullClass); | 711 registry.registerInstantiatedClass(compiler.nullClass); |
| 712 } | 712 } |
| 713 | 713 |
| 714 if (Elements.isStaticOrTopLevelField(element)) { | 714 if (Elements.isStaticOrTopLevelField(element)) { |
| 715 visitor.addDeferredAction(element, () { | 715 visitor.addDeferredAction(element, () { |
| 716 if (element.modifiers.isConst) { | 716 if (element.modifiers.isConst) { |
| 717 constantCompiler.compileConstant(element); | 717 element.constant = constantCompiler.compileConstant(element); |
| 718 } else { | 718 } else { |
| 719 constantCompiler.compileVariable(element); | 719 constantCompiler.compileVariable(element); |
| 720 } | 720 } |
| 721 }); | 721 }); |
| 722 if (initializer != null) { | 722 if (initializer != null) { |
| 723 if (!element.modifiers.isConst) { | 723 if (!element.modifiers.isConst) { |
| 724 // TODO(johnniwinther): Determine the const-ness eagerly to avoid | 724 // TODO(johnniwinther): Determine the const-ness eagerly to avoid |
| 725 // unnecessary registrations. | 725 // unnecessary registrations. |
| 726 registry.registerLazyField(); | 726 registry.registerLazyField(); |
| 727 } | 727 } |
| (...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 if (element.isInitializingFormal) { | 2420 if (element.isInitializingFormal) { |
| 2421 registry.useElement(parameterNode, element); | 2421 registry.useElement(parameterNode, element); |
| 2422 } else { | 2422 } else { |
| 2423 LocalParameterElement parameterElement = element; | 2423 LocalParameterElement parameterElement = element; |
| 2424 defineLocalVariable(parameterNode, parameterElement); | 2424 defineLocalVariable(parameterNode, parameterElement); |
| 2425 addToScope(parameterElement); | 2425 addToScope(parameterElement); |
| 2426 } | 2426 } |
| 2427 parameterNodes = parameterNodes.tail; | 2427 parameterNodes = parameterNodes.tail; |
| 2428 }); | 2428 }); |
| 2429 addDeferredAction(enclosingElement, () { | 2429 addDeferredAction(enclosingElement, () { |
| 2430 functionParameters.forEachOptionalParameter((Element parameter) { | 2430 functionParameters.forEachOptionalParameter( |
| 2431 compiler.resolver.constantCompiler.compileConstant(parameter); | 2431 (ParameterElementX parameter) { |
| 2432 parameter.constant = |
| 2433 compiler.resolver.constantCompiler.compileConstant(parameter); |
| 2432 }); | 2434 }); |
| 2433 }); | 2435 }); |
| 2434 if (inCheckContext) { | 2436 if (inCheckContext) { |
| 2435 functionParameters.forEachParameter((ParameterElement element) { | 2437 functionParameters.forEachParameter((ParameterElement element) { |
| 2436 registry.registerIsCheck(element.type); | 2438 registry.registerIsCheck(element.type); |
| 2437 }); | 2439 }); |
| 2438 } | 2440 } |
| 2439 } | 2441 } |
| 2440 | 2442 |
| 2441 visitCascade(Cascade node) { | 2443 visitCascade(Cascade node) { |
| (...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4862 if (definitions.modifiers.isFinal && | 4864 if (definitions.modifiers.isFinal && |
| 4863 !resolver.allowFinalWithoutInitializer) { | 4865 !resolver.allowFinalWithoutInitializer) { |
| 4864 compiler.reportError(node, MessageKind.FINAL_WITHOUT_INITIALIZER); | 4866 compiler.reportError(node, MessageKind.FINAL_WITHOUT_INITIALIZER); |
| 4865 } | 4867 } |
| 4866 return node; | 4868 return node; |
| 4867 } | 4869 } |
| 4868 | 4870 |
| 4869 visitNodeList(NodeList node) { | 4871 visitNodeList(NodeList node) { |
| 4870 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { | 4872 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { |
| 4871 Identifier name = visit(link.head); | 4873 Identifier name = visit(link.head); |
| 4872 LocalVariableElement element = new LocalVariableElementX( | 4874 LocalVariableElementX element = new LocalVariableElementX( |
| 4873 name.source, resolver.enclosingElement, | 4875 name.source, resolver.enclosingElement, |
| 4874 variables, name.token); | 4876 variables, name.token); |
| 4875 resolver.defineLocalVariable(link.head, element); | 4877 resolver.defineLocalVariable(link.head, element); |
| 4876 resolver.addToScope(element); | 4878 resolver.addToScope(element); |
| 4877 if (definitions.modifiers.isConst) { | 4879 if (definitions.modifiers.isConst) { |
| 4878 compiler.enqueuer.resolution.addDeferredAction(element, () { | 4880 compiler.enqueuer.resolution.addDeferredAction(element, () { |
| 4879 compiler.resolver.constantCompiler.compileConstant(element); | 4881 element.constant = |
| 4882 compiler.resolver.constantCompiler.compileConstant(element); |
| 4880 }); | 4883 }); |
| 4881 } | 4884 } |
| 4882 } | 4885 } |
| 4883 } | 4886 } |
| 4884 } | 4887 } |
| 4885 | 4888 |
| 4886 class ConstructorResolver extends CommonResolverVisitor<Element> { | 4889 class ConstructorResolver extends CommonResolverVisitor<Element> { |
| 4887 final ResolverVisitor resolver; | 4890 final ResolverVisitor resolver; |
| 4888 bool inConstContext; | 4891 bool inConstContext; |
| 4889 DartType type; | 4892 DartType type; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5148 } | 5151 } |
| 5149 | 5152 |
| 5150 /// The result for the resolution of the `assert` method. | 5153 /// The result for the resolution of the `assert` method. |
| 5151 class AssertResult implements ResolutionResult { | 5154 class AssertResult implements ResolutionResult { |
| 5152 const AssertResult(); | 5155 const AssertResult(); |
| 5153 | 5156 |
| 5154 Element get element => null; | 5157 Element get element => null; |
| 5155 | 5158 |
| 5156 String toString() => 'AssertResult()'; | 5159 String toString() => 'AssertResult()'; |
| 5157 } | 5160 } |
| OLD | NEW |