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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 19097003: Support new malformed types semantics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix unittests. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index ce2fdb1e16cdd7a6e45878d2802e4f5a8fb71917..d9f7c5bc4240f174e74dc6582889cb91b6886239 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -340,7 +340,7 @@ class TypeCheckerVisitor extends Visitor<DartType> {
DartType previous = expectedReturnType;
expectedReturnType = returnType;
StatementType bodyType = analyze(node.body);
- if (returnType != types.voidType && returnType != types.dynamicType
+ if (returnType != types.voidType && !returnType.treatAsDynamic
&& bodyType != StatementType.RETURNING) {
MessageKind kind;
if (bodyType == StatementType.MAYBE_RETURNING) {
@@ -394,7 +394,7 @@ class TypeCheckerVisitor extends Visitor<DartType> {
ElementAccess lookupMember(Node node, DartType type, SourceString name,
MemberKind memberKind) {
- if (identical(type, types.dynamicType)) {
+ if (type.treatAsDynamic) {
return const DynamicAccess();
}
Member member = type.lookupMember(name,
@@ -552,9 +552,7 @@ class TypeCheckerVisitor extends Visitor<DartType> {
}
// e.foo() for some expression e.
DartType receiverType = analyze(node.receiver);
- if (receiverType.isDynamic ||
- receiverType.isMalformed ||
- receiverType.isVoid) {
+ if (receiverType.treatAsDynamic || receiverType.isVoid) {
return const DynamicAccess();
}
TypeKind receiverKind = receiverType.kind;

Powered by Google App Engine
This is Rietveld 408576698