OLD | NEW |
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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 | 1110 |
1111 // TODO(johnniwinther): Use seen type tests to avoid registration of | 1111 // TODO(johnniwinther): Use seen type tests to avoid registration of |
1112 // mutation/access to unpromoted variables. | 1112 // mutation/access to unpromoted variables. |
1113 | 1113 |
1114 Send notTypeNode = node.arguments.head.asSend(); | 1114 Send notTypeNode = node.arguments.head.asSend(); |
1115 DartType type; | 1115 DartType type; |
1116 SendStructure sendStructure; | 1116 SendStructure sendStructure; |
1117 if (notTypeNode != null) { | 1117 if (notTypeNode != null) { |
1118 // `e is! T`. | 1118 // `e is! T`. |
1119 Node typeNode = notTypeNode.receiver; | 1119 Node typeNode = notTypeNode.receiver; |
1120 type = resolveTypeAnnotation(typeNode); | 1120 type = resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false); |
1121 sendStructure = new IsNotStructure(type); | 1121 sendStructure = new IsNotStructure(type); |
1122 } else { | 1122 } else { |
1123 // `e is T`. | 1123 // `e is T`. |
1124 Node typeNode = node.arguments.head; | 1124 Node typeNode = node.arguments.head; |
1125 type = resolveTypeAnnotation(typeNode); | 1125 type = resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false); |
1126 sendStructure = new IsStructure(type); | 1126 sendStructure = new IsStructure(type); |
1127 } | 1127 } |
1128 | 1128 |
1129 // GENERIC_METHODS: Method type variables are not reified so we must warn | 1129 // GENERIC_METHODS: Method type variables are not reified so we must warn |
1130 // about the error which will occur at runtime. | 1130 // about the error which will occur at runtime. |
1131 if (type is MethodTypeVariableType) { | 1131 if (type is MethodTypeVariableType) { |
1132 reporter.reportWarningMessage( | 1132 reporter.reportWarningMessage( |
1133 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED); | 1133 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED); |
1134 } | 1134 } |
1135 | 1135 |
1136 registry.registerTypeUse(new TypeUse.isCheck(type)); | 1136 registry.registerTypeUse(new TypeUse.isCheck(type)); |
1137 registry.registerSendStructure(node, sendStructure); | 1137 registry.registerSendStructure(node, sendStructure); |
1138 return const NoneResult(); | 1138 return const NoneResult(); |
1139 } | 1139 } |
1140 | 1140 |
1141 /// Handle a type cast expression, like `a as T`. | 1141 /// Handle a type cast expression, like `a as T`. |
1142 ResolutionResult handleAs(Send node) { | 1142 ResolutionResult handleAs(Send node) { |
1143 Node expression = node.receiver; | 1143 Node expression = node.receiver; |
1144 visitExpression(expression); | 1144 visitExpression(expression); |
1145 | 1145 |
1146 Node typeNode = node.arguments.head; | 1146 Node typeNode = node.arguments.head; |
1147 DartType type = resolveTypeAnnotation(typeNode); | 1147 DartType type = |
| 1148 resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false); |
1148 | 1149 |
1149 // GENERIC_METHODS: Method type variables are not reified so we must warn | 1150 // GENERIC_METHODS: Method type variables are not reified so we must warn |
1150 // about the error which will occur at runtime. | 1151 // about the error which will occur at runtime. |
1151 if (type is MethodTypeVariableType) { | 1152 if (type is MethodTypeVariableType) { |
1152 reporter.reportWarningMessage( | 1153 reporter.reportWarningMessage( |
1153 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED); | 1154 node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED); |
1154 } | 1155 } |
1155 | 1156 |
1156 registry.registerTypeUse(new TypeUse.asCast(type)); | 1157 registry.registerTypeUse(new TypeUse.asCast(type)); |
1157 registry.registerSendStructure(node, new AsStructure(type)); | 1158 registry.registerSendStructure(node, new AsStructure(type)); |
(...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4731 } | 4732 } |
4732 return const NoneResult(); | 4733 return const NoneResult(); |
4733 } | 4734 } |
4734 } | 4735 } |
4735 | 4736 |
4736 /// Looks up [name] in [scope] and unwraps the result. | 4737 /// Looks up [name] in [scope] and unwraps the result. |
4737 Element lookupInScope( | 4738 Element lookupInScope( |
4738 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4739 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
4739 return Elements.unwrap(scope.lookup(name), reporter, node); | 4740 return Elements.unwrap(scope.lookup(name), reporter, node); |
4740 } | 4741 } |
OLD | NEW |