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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2473743002: Changed warning to hint for `x as T` where T is a method type variable. (Closed)
Patch Set: Created 4 years, 1 month 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 | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compile_time_constants.dart'; 10 import '../compile_time_constants.dart';
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 1135
1136 /// Handle a type cast expression, like `a as T`. 1136 /// Handle a type cast expression, like `a as T`.
1137 ResolutionResult handleAs(Send node) { 1137 ResolutionResult handleAs(Send node) {
1138 Node expression = node.receiver; 1138 Node expression = node.receiver;
1139 visitExpression(expression); 1139 visitExpression(expression);
1140 1140
1141 Node typeNode = node.arguments.head; 1141 Node typeNode = node.arguments.head;
1142 DartType type = 1142 DartType type =
1143 resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false); 1143 resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false);
1144 1144
1145 // GENERIC_METHODS: Method type variables are not reified so we must warn 1145 // GENERIC_METHODS: Method type variables are not reified, so we must inform
1146 // about the error which will occur at runtime. 1146 // the developer about the potentially bug-inducing semantics.
1147 if (type is MethodTypeVariableType) { 1147 if (type is MethodTypeVariableType) {
1148 reporter.reportWarningMessage( 1148 reporter.reportHintMessage(
1149 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC); 1149 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC);
1150 } 1150 }
1151 1151
1152 registry.registerTypeUse(new TypeUse.asCast(type)); 1152 registry.registerTypeUse(new TypeUse.asCast(type));
1153 registry.registerSendStructure(node, new AsStructure(type)); 1153 registry.registerSendStructure(node, new AsStructure(type));
1154 return const NoneResult(); 1154 return const NoneResult();
1155 } 1155 }
1156 1156
1157 /// Handle the unary expression of an unresolved unary operator [text], like 1157 /// Handle the unary expression of an unresolved unary operator [text], like
1158 /// the no longer supported `+a`. 1158 /// the no longer supported `+a`.
(...skipping 3584 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 } 4743 }
4744 return const NoneResult(); 4744 return const NoneResult();
4745 } 4745 }
4746 } 4746 }
4747 4747
4748 /// Looks up [name] in [scope] and unwraps the result. 4748 /// Looks up [name] in [scope] and unwraps the result.
4749 Element lookupInScope( 4749 Element lookupInScope(
4750 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4750 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4751 return Elements.unwrap(scope.lookup(name), reporter, node); 4751 return Elements.unwrap(scope.lookup(name), reporter, node);
4752 } 4752 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698