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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 final DartType expectedType; | 457 final DartType expectedType; |
458 | 458 |
459 InvalidParameterDeclaration( | 459 InvalidParameterDeclaration( |
460 TypeRules rules, FormalParameter declaration, this.expectedType) | 460 TypeRules rules, FormalParameter declaration, this.expectedType) |
461 : super(declaration); | 461 : super(declaration); |
462 | 462 |
463 @override List<Object> get arguments => [node, expectedType]; | 463 @override List<Object> get arguments => [node, expectedType]; |
464 @override String get message => 'Type check failed: {0} is not of type {1}'; | 464 @override String get message => 'Type check failed: {0} is not of type {1}'; |
465 } | 465 } |
466 | 466 |
467 class InvalidRuntimeCheckError extends StaticError { | 467 class NonGroundTypeCheckInfo extends StaticInfo { |
468 final DartType type; | 468 final DartType type; |
| 469 final AstNode node; |
469 | 470 |
470 InvalidRuntimeCheckError(AstNode node, this.type) : super(node) { | 471 NonGroundTypeCheckInfo(this.node, this.type) { |
471 assert(node is IsExpression || node is AsExpression); | 472 assert(node is IsExpression || node is AsExpression); |
472 } | 473 } |
473 | 474 |
474 @override List<Object> get arguments => [type]; | 475 @override List<Object> get arguments => [type]; |
475 String get message => "Invalid runtime check on non-ground type {0}"; | 476 String get message => |
| 477 "Runtime check on non-ground type {0} may throw StrongModeError"; |
| 478 |
| 479 toErrorCode() => new HintCode(name, message); |
476 } | 480 } |
477 | 481 |
478 // Invalid override of an instance member of a class. | 482 // Invalid override of an instance member of a class. |
479 abstract class InvalidOverride extends StaticError { | 483 abstract class InvalidOverride extends StaticError { |
480 /// Member declaration with the invalid override. | 484 /// Member declaration with the invalid override. |
481 final ExecutableElement element; | 485 final ExecutableElement element; |
482 | 486 |
483 /// Type (class or interface) that provides the base declaration. | 487 /// Type (class or interface) that provides the base declaration. |
484 final InterfaceType base; | 488 final InterfaceType base; |
485 | 489 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 /// Better to have `super` at the end, as required by the Dart style guide: | 573 /// Better to have `super` at the end, as required by the Dart style guide: |
570 /// <http://goo.gl/q1T4BB> | 574 /// <http://goo.gl/q1T4BB> |
571 /// | 575 /// |
572 /// For now this is the only pattern we support. | 576 /// For now this is the only pattern we support. |
573 class InvalidSuperInvocation extends StaticError { | 577 class InvalidSuperInvocation extends StaticError { |
574 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); | 578 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); |
575 | 579 |
576 @override String get message => "super call must be last in an initializer " | 580 @override String get message => "super call must be last in an initializer " |
577 "list (see http://goo.gl/q1T4BB): {0}"; | 581 "list (see http://goo.gl/q1T4BB): {0}"; |
578 } | 582 } |
OLD | NEW |