| 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.dart.constant.evaluation; | 5 library analyzer.src.dart.constant.evaluation; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/context/declared_variables.dart'; | 9 import 'package:analyzer/context/declared_variables.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // const factory constructors in the SDK, or if the code contains | 298 // const factory constructors in the SDK, or if the code contains |
| 299 // errors (such as delegating to a non-const constructor, or delegatin
g | 299 // errors (such as delegating to a non-const constructor, or delegatin
g |
| 300 // to a constructor that can't be resolved). In any of these cases, | 300 // to a constructor that can't be resolved). In any of these cases, |
| 301 // we'll evaluate calls to this constructor without having to refer to | 301 // we'll evaluate calls to this constructor without having to refer to |
| 302 // any other constants. So we don't need to report any dependencies. | 302 // any other constants. So we don't need to report any dependencies. |
| 303 return; | 303 return; |
| 304 } | 304 } |
| 305 bool defaultSuperInvocationNeeded = true; | 305 bool defaultSuperInvocationNeeded = true; |
| 306 List<ConstructorInitializer> initializers = | 306 List<ConstructorInitializer> initializers = |
| 307 constant.constantInitializers; | 307 constant.constantInitializers; |
| 308 for (ConstructorInitializer initializer in initializers) { | 308 if (initializers != null) { |
| 309 if (initializer is SuperConstructorInvocation || | 309 for (ConstructorInitializer initializer in initializers) { |
| 310 initializer is RedirectingConstructorInvocation) { | 310 if (initializer is SuperConstructorInvocation || |
| 311 defaultSuperInvocationNeeded = false; | 311 initializer is RedirectingConstructorInvocation) { |
| 312 defaultSuperInvocationNeeded = false; |
| 313 } |
| 314 initializer.accept(referenceFinder); |
| 312 } | 315 } |
| 313 initializer.accept(referenceFinder); | |
| 314 } | 316 } |
| 315 if (defaultSuperInvocationNeeded) { | 317 if (defaultSuperInvocationNeeded) { |
| 316 // No explicit superconstructor invocation found, so we need to | 318 // No explicit superconstructor invocation found, so we need to |
| 317 // manually insert a reference to the implicit superconstructor. | 319 // manually insert a reference to the implicit superconstructor. |
| 318 InterfaceType superclass = | 320 InterfaceType superclass = |
| 319 (constant.returnType as InterfaceType).superclass; | 321 (constant.returnType as InterfaceType).superclass; |
| 320 if (superclass != null && !superclass.isObject) { | 322 if (superclass != null && !superclass.isObject) { |
| 321 ConstructorElement unnamedConstructor = | 323 ConstructorElement unnamedConstructor = |
| 322 getConstructorImpl(superclass.element.unnamedConstructor); | 324 getConstructorImpl(superclass.element.unnamedConstructor); |
| 323 if (unnamedConstructor != null) { | 325 if (unnamedConstructor != null) { |
| (...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 } | 2086 } |
| 2085 | 2087 |
| 2086 @override | 2088 @override |
| 2087 String toString() { | 2089 String toString() { |
| 2088 if (value == null) { | 2090 if (value == null) { |
| 2089 return "error"; | 2091 return "error"; |
| 2090 } | 2092 } |
| 2091 return value.toString(); | 2093 return value.toString(); |
| 2092 } | 2094 } |
| 2093 } | 2095 } |
| OLD | NEW |