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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2062793003: Revert "Revert "Refactor strong mode to use standard Analyzer errors"" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 12 matching lines...) Expand all
23 import 'package:analyzer/src/generated/element_resolver.dart'; 23 import 'package:analyzer/src/generated/element_resolver.dart';
24 import 'package:analyzer/src/generated/engine.dart'; 24 import 'package:analyzer/src/generated/engine.dart';
25 import 'package:analyzer/src/generated/error.dart'; 25 import 'package:analyzer/src/generated/error.dart';
26 import 'package:analyzer/src/generated/java_engine.dart'; 26 import 'package:analyzer/src/generated/java_engine.dart';
27 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 27 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
28 import 'package:analyzer/src/generated/resolver.dart'; 28 import 'package:analyzer/src/generated/resolver.dart';
29 import 'package:analyzer/src/generated/sdk.dart' show DartSdk, SdkLibrary; 29 import 'package:analyzer/src/generated/sdk.dart' show DartSdk, SdkLibrary;
30 import 'package:analyzer/src/generated/source.dart'; 30 import 'package:analyzer/src/generated/source.dart';
31 import 'package:analyzer/src/generated/utilities_dart.dart'; 31 import 'package:analyzer/src/generated/utilities_dart.dart';
32 import 'package:analyzer/src/task/dart.dart'; 32 import 'package:analyzer/src/task/dart.dart';
33 import 'package:analyzer/src/task/strong/info.dart' show StaticInfo; 33 import 'package:analyzer/src/task/strong/checker.dart' as checker
34 show isKnownFunction;
34 35
35 /** 36 /**
36 * A visitor used to traverse an AST structure looking for additional errors and 37 * A visitor used to traverse an AST structure looking for additional errors and
37 * warnings not covered by the parser and resolver. 38 * warnings not covered by the parser and resolver.
38 */ 39 */
39 class ErrorVerifier extends RecursiveAstVisitor<Object> { 40 class ErrorVerifier extends RecursiveAstVisitor<Object> {
40 /** 41 /**
41 * Static final string with value `"getter "` used in the construction of the 42 * Static final string with value `"getter "` used in the construction of the
42 * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and 43 * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and
43 * similar, error code messages. 44 * similar, error code messages.
(...skipping 5692 matching lines...) Expand 10 before | Expand all | Expand 10 after
5736 DartType staticReturnType = getStaticType(returnExpression); 5737 DartType staticReturnType = getStaticType(returnExpression);
5737 if (staticReturnType != null && _enclosingFunction.isAsynchronous) { 5738 if (staticReturnType != null && _enclosingFunction.isAsynchronous) {
5738 return _typeProvider.futureType.instantiate( 5739 return _typeProvider.futureType.instantiate(
5739 <DartType>[staticReturnType.flattenFutures(_typeSystem)]); 5740 <DartType>[staticReturnType.flattenFutures(_typeSystem)]);
5740 } 5741 }
5741 return staticReturnType; 5742 return staticReturnType;
5742 } 5743 }
5743 5744
5744 bool _expressionIsAssignableAtType(Expression expression, 5745 bool _expressionIsAssignableAtType(Expression expression,
5745 DartType actualStaticType, DartType expectedStaticType) { 5746 DartType actualStaticType, DartType expectedStaticType) {
5746 bool concrete = 5747 bool concrete = _options.strongMode && checker.isKnownFunction(expression);
5747 _options.strongMode && StaticInfo.isKnownFunction(expression);
5748 if (concrete) { 5748 if (concrete) {
5749 actualStaticType = 5749 actualStaticType =
5750 _typeSystem.typeToConcreteType(_typeProvider, actualStaticType); 5750 _typeSystem.typeToConcreteType(_typeProvider, actualStaticType);
5751 // TODO(leafp): Move the Downcast functionality here. 5751 // TODO(leafp): Move the Downcast functionality here.
5752 // TODO(leafp): Support strict downcasts 5752 // TODO(leafp): Support strict downcasts
5753 } 5753 }
5754 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType); 5754 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType);
5755 } 5755 }
5756 5756
5757 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) { 5757 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) {
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
6307 class _InvocationCollector extends RecursiveAstVisitor { 6307 class _InvocationCollector extends RecursiveAstVisitor {
6308 final List<String> superCalls = <String>[]; 6308 final List<String> superCalls = <String>[];
6309 6309
6310 @override 6310 @override
6311 visitMethodInvocation(MethodInvocation node) { 6311 visitMethodInvocation(MethodInvocation node) {
6312 if (node.target is SuperExpression) { 6312 if (node.target is SuperExpression) {
6313 superCalls.add(node.methodName.name); 6313 superCalls.add(node.methodName.name);
6314 } 6314 }
6315 } 6315 }
6316 } 6316 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698