Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: pkg/analyzer/lib/src/task/strong/info.dart

Issue 1501633003: Strong-mode error code validation "enum" (#25117). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 String get message; 478 String get message;
479 479
480 toErrorCode() => new CompileTimeErrorCode(name, message); 480 toErrorCode() => new CompileTimeErrorCode(name, message);
481 } 481 }
482 482
483 // TODO(jmesserly): this could use some refactoring. These are essentially 483 // TODO(jmesserly): this could use some refactoring. These are essentially
484 // like ErrorCodes in analyzer, but we're including some details in our message. 484 // like ErrorCodes in analyzer, but we're including some details in our message.
485 // Analyzer instead has template strings, and replaces '{0}' with the first 485 // Analyzer instead has template strings, and replaces '{0}' with the first
486 // argument. 486 // argument.
487 abstract class StaticInfo { 487 abstract class StaticInfo {
488 /// Strong-mode error code names.
489 ///
490 /// Used for error code configuration validation in `.analysis_options`.
491 static const List<String> names = const [
Jennifer Messerly 2015/12/05 00:59:27 consider: lazy initialized Set for faster lookup?
pquitslund 2015/12/06 17:07:18 I talked myself out of this with the ErrorCodes en
492 //
493 // Manually populated.
494 //
495 'STRONG_MODE_ASSIGNMENT_CAST',
496 'STRONG_MODE_DOWN_CAST_COMPOSITE',
497 'STRONG_MODE_DOWN_CAST_IMPLICIT',
498 'STRONG_MODE_DYNAMIC_CAST',
499 'STRONG_MODE_DYNAMIC_INVOKE',
500 'STRONG_MODE_INFERRED_TYPE',
501 'STRONG_MODE_INFERRED_TYPE_ALLOCATION',
502 'STRONG_MODE_INFERRED_TYPE_CLOSURE',
503 'STRONG_MODE_INFERRED_TYPE_LITERAL',
504 'STRONG_MODE_INVALID_FIELD_OVERRIDE',
505 'STRONG_MODE_INVALID_METHOD_OVERRIDE',
506 'STRONG_MODE_INVALID_PARAMETER_DECLARATION',
507 'STRONG_MODE_INVALID_SUPER_INVOCATION',
508 'STRONG_MODE_INVALID_VARIABLE_DECLARATION',
509 'STRONG_MODE_NON_GROUND_TYPE_CHECK_INFO',
510 'STRONG_MODE_STATIC_TYPE_ERROR',
511 'STRONG_MODE_UNINFERRED_CLOSURE',
512 ];
513
488 List<Object> get arguments => [node]; 514 List<Object> get arguments => [node];
489 515
490 String get name; 516 String get name;
491 517
492 /// AST Node this info is attached to. 518 /// AST Node this info is attached to.
493 AstNode get node; 519 AstNode get node;
494 520
495 AnalysisError toAnalysisError() { 521 AnalysisError toAnalysisError() {
496 int begin = node is AnnotatedNode 522 int begin = node is AnnotatedNode
497 ? (node as AnnotatedNode).firstTokenAfterCommentAndMetadata.offset 523 ? (node as AnnotatedNode).firstTokenAfterCommentAndMetadata.offset
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // TODO(vsm,leafp): Remove this. 563 // TODO(vsm,leafp): Remove this.
538 class UninferredClosure extends DownCast { 564 class UninferredClosure extends DownCast {
539 UninferredClosure(TypeRules rules, FunctionExpression expression, Cast cast) 565 UninferredClosure(TypeRules rules, FunctionExpression expression, Cast cast)
540 : super._internal(rules, expression, cast); 566 : super._internal(rules, expression, cast);
541 567
542 @override 568 @override
543 String get name => 'STRONG_MODE_UNINFERRED_CLOSURE'; 569 String get name => 'STRONG_MODE_UNINFERRED_CLOSURE';
544 570
545 toErrorCode() => new StaticTypeWarningCode(name, message); 571 toErrorCode() => new StaticTypeWarningCode(name, message);
546 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698