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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // Invalid override due to incompatible type. I.e., the overridden signature | 520 // Invalid override due to incompatible type. I.e., the overridden signature |
521 // is not compatible with the original. | 521 // is not compatible with the original. |
522 class InvalidMethodOverride extends InvalidOverride { | 522 class InvalidMethodOverride extends InvalidOverride { |
523 InvalidMethodOverride(AstNode node, ExecutableElement element, | 523 InvalidMethodOverride(AstNode node, ExecutableElement element, |
524 InterfaceType base, FunctionType subType, FunctionType baseType) | 524 InterfaceType base, FunctionType subType, FunctionType baseType) |
525 : super(node, element, base, subType, baseType); | 525 : super(node, element, base, subType, baseType); |
526 | 526 |
527 String get message => _messageHelper('Invalid override'); | 527 String get message => _messageHelper('Invalid override'); |
528 } | 528 } |
529 | 529 |
530 // TODO(sigmund): delete, if we fix this, this should be part of the type | |
531 // inference, not something we detect in the checker. | |
532 // TODO(sigmund): split and track field, getter, setter, method separately | |
533 class InferableOverride extends InvalidOverride { | |
534 InferableOverride(AstNode node, ExecutableElement element, InterfaceType base, | |
535 DartType subType, DartType baseType) | |
536 : super(node, element, base, subType, baseType); | |
537 | |
538 toErrorCode() => new CompileTimeErrorCode(name, message); | |
539 String get message => _messageHelper('Invalid but inferable override'); | |
540 } | |
541 | |
542 /// Used to mark unexpected situations in our compiler were we couldn't compute | 530 /// Used to mark unexpected situations in our compiler were we couldn't compute |
543 /// the type of an expression. | 531 /// the type of an expression. |
544 // TODO(sigmund): This is normally a result of another error that is caught by | 532 // TODO(sigmund): This is normally a result of another error that is caught by |
545 // the analyzer, so this should likely be removed in the future. | 533 // the analyzer, so this should likely be removed in the future. |
546 class MissingTypeError extends StaticInfo { | 534 class MissingTypeError extends StaticInfo { |
547 final AstNode node; | 535 final AstNode node; |
548 toErrorCode() => new StaticTypeWarningCode(name, message); | 536 toErrorCode() => new StaticTypeWarningCode(name, message); |
549 | 537 |
550 MissingTypeError(this.node); | 538 MissingTypeError(this.node); |
551 | 539 |
(...skipping 29 matching lines...) Expand all Loading... |
581 /// Better to have `super` at the end, as required by the Dart style guide: | 569 /// Better to have `super` at the end, as required by the Dart style guide: |
582 /// <http://goo.gl/q1T4BB> | 570 /// <http://goo.gl/q1T4BB> |
583 /// | 571 /// |
584 /// For now this is the only pattern we support. | 572 /// For now this is the only pattern we support. |
585 class InvalidSuperInvocation extends StaticError { | 573 class InvalidSuperInvocation extends StaticError { |
586 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); | 574 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); |
587 | 575 |
588 @override String get message => "super call must be last in an initializer " | 576 @override String get message => "super call must be last in an initializer " |
589 "list (see http://goo.gl/q1T4BB): {0}"; | 577 "list (see http://goo.gl/q1T4BB): {0}"; |
590 } | 578 } |
OLD | NEW |