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

Side by Side Diff: lib/src/checker/checker.dart

Issue 1398873002: remove "infer from overrides" option which is now obsolete (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « no previous file | lib/src/checker/resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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;
11 11
12 import '../../strong_mode.dart' show StrongModeOptions; 12 import '../../strong_mode.dart' show StrongModeOptions;
13 import '../info.dart'; 13 import '../info.dart';
14 import '../utils.dart' show getMemberType; 14 import '../utils.dart' show getMemberType;
15 import 'rules.dart'; 15 import 'rules.dart';
16 16
17 /// Checks for overriding declarations of fields and methods. This is used to 17 /// Checks for overriding declarations of fields and methods. This is used to
18 /// check overrides between classes and superclasses, interfaces, and mixin 18 /// check overrides between classes and superclasses, interfaces, and mixin
19 /// applications. 19 /// applications.
20 class _OverrideChecker { 20 class _OverrideChecker {
21 bool _failure = false; 21 bool _failure = false;
22 final TypeRules _rules; 22 final TypeRules _rules;
23 final AnalysisErrorListener _reporter; 23 final AnalysisErrorListener _reporter;
24 final bool _inferFromOverrides; 24
25 _OverrideChecker(this._rules, this._reporter, StrongModeOptions options) 25 _OverrideChecker(this._rules, this._reporter);
26 : _inferFromOverrides = options.inferFromOverrides;
27 26
28 void check(ClassDeclaration node) { 27 void check(ClassDeclaration node) {
29 if (node.element.type.isObject) return; 28 if (node.element.type.isObject) return;
30 _checkSuperOverrides(node); 29 _checkSuperOverrides(node);
31 _checkMixinApplicationOverrides(node); 30 _checkMixinApplicationOverrides(node);
32 _checkAllInterfaceOverrides(node); 31 _checkAllInterfaceOverrides(node);
33 } 32 }
34 33
35 /// Check overrides from mixin applications themselves. For example, in: 34 /// Check overrides from mixin applications themselves. For example, in:
36 /// 35 ///
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 final AnalysisErrorListener reporter; 328 final AnalysisErrorListener reporter;
330 final _OverrideChecker _overrideChecker; 329 final _OverrideChecker _overrideChecker;
331 bool _failure = false; 330 bool _failure = false;
332 bool get failure => _failure || _overrideChecker._failure; 331 bool get failure => _failure || _overrideChecker._failure;
333 332
334 void reset() { 333 void reset() {
335 _failure = false; 334 _failure = false;
336 _overrideChecker._failure = false; 335 _overrideChecker._failure = false;
337 } 336 }
338 337
339 CodeChecker(TypeRules rules, AnalysisErrorListener reporter, 338 CodeChecker(TypeRules rules, AnalysisErrorListener reporter)
340 StrongModeOptions options)
341 : rules = rules, 339 : rules = rules,
342 reporter = reporter, 340 reporter = reporter,
343 _overrideChecker = new _OverrideChecker(rules, reporter, options); 341 _overrideChecker = new _OverrideChecker(rules, reporter);
344 342
345 @override 343 @override
346 void visitCompilationUnit(CompilationUnit unit) { 344 void visitCompilationUnit(CompilationUnit unit) {
347 void report(Expression expr) { 345 void report(Expression expr) {
348 reporter.onError(new MissingTypeError(expr).toAnalysisError()); 346 reporter.onError(new MissingTypeError(expr).toAnalysisError());
349 } 347 }
350 var callback = rules.reportMissingType; 348 var callback = rules.reportMissingType;
351 rules.reportMissingType = report; 349 rules.reportMissingType = report;
352 unit.visitChildren(this); 350 unit.visitChildren(this);
353 rules.reportMissingType = callback; 351 rules.reportMissingType = callback;
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (info is CoercionInfo) { 959 if (info is CoercionInfo) {
962 // TODO(jmesserly): if we're run again on the same AST, we'll produce the 960 // TODO(jmesserly): if we're run again on the same AST, we'll produce the
963 // same annotations. This should be harmless. This might go away once 961 // same annotations. This should be harmless. This might go away once
964 // CodeChecker is integrated better with analyzer, as it will know that 962 // CodeChecker is integrated better with analyzer, as it will know that
965 // checking has already been performed. 963 // checking has already been performed.
966 // assert(CoercionInfo.get(info.node) == null); 964 // assert(CoercionInfo.get(info.node) == null);
967 CoercionInfo.set(info.node, info); 965 CoercionInfo.set(info.node, info);
968 } 966 }
969 } 967 }
970 } 968 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/checker/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698