| 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'; |
| 11 import 'package:analyzer/src/generated/error.dart' as analyzer; | 11 import 'package:analyzer/src/generated/error.dart' |
| 12 show AnalysisError, ErrorSeverity; |
| 12 import 'package:logging/logging.dart' show Level; | 13 import 'package:logging/logging.dart' show Level; |
| 13 | 14 |
| 14 import 'package:dev_compiler/src/checker/rules.dart'; | 15 import 'package:dev_compiler/src/checker/rules.dart'; |
| 15 import 'package:dev_compiler/src/utils.dart' as utils; | 16 import 'package:dev_compiler/src/utils.dart' as utils; |
| 16 | 17 |
| 17 import 'report.dart' show Message; | 18 import 'report.dart' show Message; |
| 18 | 19 |
| 19 /// Represents a summary of the results collected by running the program | 20 /// Represents a summary of the results collected by running the program |
| 20 /// checker. | 21 /// checker. |
| 21 class CheckerResults { | 22 class CheckerResults { |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 /// <http://goo.gl/q1T4BB> | 522 /// <http://goo.gl/q1T4BB> |
| 522 /// | 523 /// |
| 523 /// For now this is the only pattern we support. | 524 /// For now this is the only pattern we support. |
| 524 class InvalidSuperInvocation extends StaticError { | 525 class InvalidSuperInvocation extends StaticError { |
| 525 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); | 526 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); |
| 526 | 527 |
| 527 String get message => "super call must be last in an initializer list " | 528 String get message => "super call must be last in an initializer list " |
| 528 "(see http://goo.gl/q1T4BB): $node"; | 529 "(see http://goo.gl/q1T4BB): $node"; |
| 529 } | 530 } |
| 530 | 531 |
| 531 class AnalyzerError extends Message { | 532 class AnalyzerMessage extends Message { |
| 532 factory AnalyzerError.from(analyzer.AnalysisError error) { | 533 factory AnalyzerMessage.from(AnalysisError error) { |
| 533 var severity = error.errorCode.type.severity; | 534 var severity = error.errorCode.type.severity; |
| 534 var isError = severity == analyzer.ErrorSeverity.WARNING; | 535 var isError = severity == ErrorSeverity.WARNING; |
| 535 var level = isError ? Level.SEVERE : Level.WARNING; | 536 var level = isError ? Level.SEVERE : Level.WARNING; |
| 536 int begin = error.offset; | 537 int begin = error.offset; |
| 537 int end = begin + error.length; | 538 int end = begin + error.length; |
| 538 return new AnalyzerError(error.message, level, begin, end); | 539 return new AnalyzerMessage(error.message, level, begin, end); |
| 539 } | 540 } |
| 540 | 541 |
| 541 const AnalyzerError(String message, Level level, int begin, int end) | 542 const AnalyzerMessage(String message, Level level, int begin, int end) |
| 542 : super(message, level, begin, end); | 543 : super(message, level, begin, end); |
| 543 } | 544 } |
| OLD | NEW |