| 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 library dev_compiler.src.checker.checker; | 5 library dev_compiler.src.checker.checker; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; | 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 bool _constantContext = false; | 340 bool _constantContext = false; |
| 341 bool _failure = false; | 341 bool _failure = false; |
| 342 bool get failure => _failure || _overrideChecker._failure; | 342 bool get failure => _failure || _overrideChecker._failure; |
| 343 | 343 |
| 344 CodeChecker( | 344 CodeChecker( |
| 345 TypeRules rules, CheckerReporter reporter, CompilerOptions options) | 345 TypeRules rules, CheckerReporter reporter, CompilerOptions options) |
| 346 : _rules = rules, | 346 : _rules = rules, |
| 347 _reporter = reporter, | 347 _reporter = reporter, |
| 348 _overrideChecker = new _OverrideChecker(rules, reporter, options); | 348 _overrideChecker = new _OverrideChecker(rules, reporter, options); |
| 349 | 349 |
| 350 @override |
| 351 visitCompilationUnit(CompilationUnit unit) { |
| 352 void report(Expression expr) { |
| 353 _reporter.log(new MissingTypeError(expr)); |
| 354 } |
| 355 var callback = _rules.reportMissingType; |
| 356 _rules.reportMissingType = report; |
| 357 unit.visitChildren(this); |
| 358 _rules.reportMissingType = callback; |
| 359 } |
| 360 |
| 350 _visitMaybeConst(AstNode n, visitNode(AstNode n)) { | 361 _visitMaybeConst(AstNode n, visitNode(AstNode n)) { |
| 351 var o = _constantContext; | 362 var o = _constantContext; |
| 352 if (!o) { | 363 if (!o) { |
| 353 if (n is VariableDeclarationList) { | 364 if (n is VariableDeclarationList) { |
| 354 _constantContext = o || n.isConst; | 365 _constantContext = o || n.isConst; |
| 355 } else if (n is VariableDeclaration) { | 366 } else if (n is VariableDeclaration) { |
| 356 _constantContext = o || n.isConst; | 367 _constantContext = o || n.isConst; |
| 357 } else if (n is FormalParameter) { | 368 } else if (n is FormalParameter) { |
| 358 _constantContext = o || n.isConst; | 369 _constantContext = o || n.isConst; |
| 359 } else if (n is InstanceCreationExpression) { | 370 } else if (n is InstanceCreationExpression) { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 void _recordDynamicInvoke(AstNode node) { | 803 void _recordDynamicInvoke(AstNode node) { |
| 793 _reporter.log(new DynamicInvoke(_rules, node)); | 804 _reporter.log(new DynamicInvoke(_rules, node)); |
| 794 } | 805 } |
| 795 | 806 |
| 796 void _recordMessage(StaticInfo info) { | 807 void _recordMessage(StaticInfo info) { |
| 797 if (info == null) return; | 808 if (info == null) return; |
| 798 if (info.level >= logger.Level.SEVERE) _failure = true; | 809 if (info.level >= logger.Level.SEVERE) _failure = true; |
| 799 _reporter.log(info); | 810 _reporter.log(info); |
| 800 } | 811 } |
| 801 } | 812 } |
| OLD | NEW |