| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Defines static information collected by the type checker and used later by | 5 /// Defines static information collected by the type checker and used later by |
| 6 /// emitters to generate code. | 6 /// emitters to generate code. |
| 7 library dev_compiler.src.info; | 7 library dev_compiler.src.info; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Standard / unspecialized inferred type | 354 // Standard / unspecialized inferred type |
| 355 class InferredType extends InferredTypeBase { | 355 class InferredType extends InferredTypeBase { |
| 356 InferredType(TypeRules rules, Expression expression, DartType type) | 356 InferredType(TypeRules rules, Expression expression, DartType type) |
| 357 : super._internal(rules, expression, type); | 357 : super._internal(rules, expression, type); |
| 358 | 358 |
| 359 // Factory to create correct InferredType variant. | 359 // Factory to create correct InferredType variant. |
| 360 static InferredTypeBase create( | 360 static InferredTypeBase create( |
| 361 TypeRules rules, Expression expression, DartType type) { | 361 TypeRules rules, Expression expression, DartType type) { |
| 362 | |
| 363 // Specialized inference: | 362 // Specialized inference: |
| 364 if (expression is Literal) { | 363 if (expression is Literal) { |
| 365 return new InferredTypeLiteral(rules, expression, type); | 364 return new InferredTypeLiteral(rules, expression, type); |
| 366 } | 365 } |
| 367 if (expression is InstanceCreationExpression) { | 366 if (expression is InstanceCreationExpression) { |
| 368 return new InferredTypeAllocation(rules, expression, type); | 367 return new InferredTypeAllocation(rules, expression, type); |
| 369 } | 368 } |
| 370 if (expression is FunctionExpression) { | 369 if (expression is FunctionExpression) { |
| 371 return new InferredTypeClosure(rules, expression, type); | 370 return new InferredTypeClosure(rules, expression, type); |
| 372 } | 371 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 /// Better to have `super` at the end, as required by the Dart style guide: | 581 /// Better to have `super` at the end, as required by the Dart style guide: |
| 583 /// <http://goo.gl/q1T4BB> | 582 /// <http://goo.gl/q1T4BB> |
| 584 /// | 583 /// |
| 585 /// For now this is the only pattern we support. | 584 /// For now this is the only pattern we support. |
| 586 class InvalidSuperInvocation extends StaticError { | 585 class InvalidSuperInvocation extends StaticError { |
| 587 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); | 586 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); |
| 588 | 587 |
| 589 @override String get message => "super call must be last in an initializer " | 588 @override String get message => "super call must be last in an initializer " |
| 590 "list (see http://goo.gl/q1T4BB): {0}"; | 589 "list (see http://goo.gl/q1T4BB): {0}"; |
| 591 } | 590 } |
| OLD | NEW |