| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 6121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6132 super.visitVariableDeclaration(node); | 6132 super.visitVariableDeclaration(node); |
| 6133 VariableElement element = node.element; | 6133 VariableElement element = node.element; |
| 6134 if (element.initializer != null && node.initializer != null) { | 6134 if (element.initializer != null && node.initializer != null) { |
| 6135 (element.initializer as FunctionElementImpl).returnType = | 6135 (element.initializer as FunctionElementImpl).returnType = |
| 6136 node.initializer.staticType; | 6136 node.initializer.staticType; |
| 6137 } | 6137 } |
| 6138 // Note: in addition to cloning the initializers for const variables, we | 6138 // Note: in addition to cloning the initializers for const variables, we |
| 6139 // have to clone the initializers for non-static final fields (because if | 6139 // have to clone the initializers for non-static final fields (because if |
| 6140 // they occur in a class with a const constructor, they will be needed to | 6140 // they occur in a class with a const constructor, they will be needed to |
| 6141 // evaluate the const constructor). | 6141 // evaluate the const constructor). |
| 6142 if ((element.isConst || | 6142 if (element is ConstVariableElement) { |
| 6143 (element is FieldElement && | |
| 6144 element.isFinal && | |
| 6145 !element.isStatic)) && | |
| 6146 node.initializer != null) { | |
| 6147 (element as ConstVariableElement).constantInitializer = | 6143 (element as ConstVariableElement).constantInitializer = |
| 6148 new ConstantAstCloner().cloneNode(node.initializer); | 6144 new ConstantAstCloner().cloneNode(node.initializer); |
| 6149 } | 6145 } |
| 6150 return null; | 6146 return null; |
| 6151 } | 6147 } |
| 6152 | 6148 |
| 6153 @override | 6149 @override |
| 6154 visitVariableDeclarationList(VariableDeclarationList node) { | 6150 visitVariableDeclarationList(VariableDeclarationList node) { |
| 6155 for (VariableDeclaration decl in node.variables) { | 6151 for (VariableDeclaration decl in node.variables) { |
| 6156 VariableElement variableElement = | 6152 VariableElement variableElement = |
| (...skipping 4511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10668 return null; | 10664 return null; |
| 10669 } | 10665 } |
| 10670 if (identical(node.staticElement, variable)) { | 10666 if (identical(node.staticElement, variable)) { |
| 10671 if (node.inSetterContext()) { | 10667 if (node.inSetterContext()) { |
| 10672 result = true; | 10668 result = true; |
| 10673 } | 10669 } |
| 10674 } | 10670 } |
| 10675 return null; | 10671 return null; |
| 10676 } | 10672 } |
| 10677 } | 10673 } |
| OLD | NEW |