| 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 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be | 7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be |
| 8 // refactored to fit into analyzer. | 8 // refactored to fit into analyzer. |
| 9 library analyzer.src.task.strong.info; | 9 library analyzer.src.task.strong.info; |
| 10 | 10 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 String get message; | 474 String get message; |
| 475 | 475 |
| 476 toErrorCode() => new CompileTimeErrorCode(name, message); | 476 toErrorCode() => new CompileTimeErrorCode(name, message); |
| 477 } | 477 } |
| 478 | 478 |
| 479 // TODO(jmesserly): this could use some refactoring. These are essentially | 479 // TODO(jmesserly): this could use some refactoring. These are essentially |
| 480 // like ErrorCodes in analyzer, but we're including some details in our message. | 480 // like ErrorCodes in analyzer, but we're including some details in our message. |
| 481 // Analyzer instead has template strings, and replaces '{0}' with the first | 481 // Analyzer instead has template strings, and replaces '{0}' with the first |
| 482 // argument. | 482 // argument. |
| 483 abstract class StaticInfo { | 483 abstract class StaticInfo { |
| 484 /// Strong-mode error code names. |
| 485 /// |
| 486 /// Used for error code configuration validation in `.analysis_options`. |
| 487 static const List<String> names = const [ |
| 488 // |
| 489 // Manually populated. |
| 490 // |
| 491 'STRONG_MODE_ASSIGNMENT_CAST', |
| 492 'STRONG_MODE_DOWN_CAST_COMPOSITE', |
| 493 'STRONG_MODE_DOWN_CAST_IMPLICIT', |
| 494 'STRONG_MODE_DYNAMIC_CAST', |
| 495 'STRONG_MODE_DYNAMIC_INVOKE', |
| 496 'STRONG_MODE_INFERRED_TYPE', |
| 497 'STRONG_MODE_INFERRED_TYPE_ALLOCATION', |
| 498 'STRONG_MODE_INFERRED_TYPE_CLOSURE', |
| 499 'STRONG_MODE_INFERRED_TYPE_LITERAL', |
| 500 'STRONG_MODE_INVALID_FIELD_OVERRIDE', |
| 501 'STRONG_MODE_INVALID_METHOD_OVERRIDE', |
| 502 'STRONG_MODE_INVALID_PARAMETER_DECLARATION', |
| 503 'STRONG_MODE_INVALID_SUPER_INVOCATION', |
| 504 'STRONG_MODE_INVALID_VARIABLE_DECLARATION', |
| 505 'STRONG_MODE_NON_GROUND_TYPE_CHECK_INFO', |
| 506 'STRONG_MODE_STATIC_TYPE_ERROR', |
| 507 'STRONG_MODE_UNINFERRED_CLOSURE', |
| 508 ]; |
| 509 |
| 484 List<Object> get arguments => [node]; | 510 List<Object> get arguments => [node]; |
| 485 | 511 |
| 486 String get name; | 512 String get name; |
| 487 | 513 |
| 488 /// AST Node this info is attached to. | 514 /// AST Node this info is attached to. |
| 489 AstNode get node; | 515 AstNode get node; |
| 490 | 516 |
| 491 AnalysisError toAnalysisError() { | 517 AnalysisError toAnalysisError() { |
| 492 int begin = node is AnnotatedNode | 518 int begin = node is AnnotatedNode |
| 493 ? (node as AnnotatedNode).firstTokenAfterCommentAndMetadata.offset | 519 ? (node as AnnotatedNode).firstTokenAfterCommentAndMetadata.offset |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // TODO(vsm,leafp): Remove this. | 559 // TODO(vsm,leafp): Remove this. |
| 534 class UninferredClosure extends DownCast { | 560 class UninferredClosure extends DownCast { |
| 535 UninferredClosure(TypeRules rules, FunctionExpression expression, Cast cast) | 561 UninferredClosure(TypeRules rules, FunctionExpression expression, Cast cast) |
| 536 : super._internal(rules, expression, cast); | 562 : super._internal(rules, expression, cast); |
| 537 | 563 |
| 538 @override | 564 @override |
| 539 String get name => 'STRONG_MODE_UNINFERRED_CLOSURE'; | 565 String get name => 'STRONG_MODE_UNINFERRED_CLOSURE'; |
| 540 | 566 |
| 541 toErrorCode() => new StaticTypeWarningCode(name, message); | 567 toErrorCode() => new StaticTypeWarningCode(name, message); |
| 542 } | 568 } |
| OLD | NEW |