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

Side by Side Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 2472993002: Fix type conversion of malformed type (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 import '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 HInstruction convertType(Compiler compiler, DartType type, int kind) { 1367 HInstruction convertType(Compiler compiler, DartType type, int kind) {
1368 if (type == null) return this; 1368 if (type == null) return this;
1369 type = type.unaliased; 1369 type = type.unaliased;
1370 // Only the builder knows how to create [HTypeConversion] 1370 // Only the builder knows how to create [HTypeConversion]
1371 // instructions with generics. It has the generic type context 1371 // instructions with generics. It has the generic type context
1372 // available. 1372 // available.
1373 assert(!type.isTypeVariable); 1373 assert(!type.isTypeVariable);
1374 assert(type.treatAsRaw || type.isFunctionType); 1374 assert(type.treatAsRaw || type.isFunctionType);
1375 if (type.isDynamic) return this; 1375 if (type.isDynamic) return this;
1376 if (type.isObject) return this; 1376 if (type.isObject) return this;
1377 // The type element is either a class or the void element.
1378 JavaScriptBackend backend = compiler.backend; 1377 JavaScriptBackend backend = compiler.backend;
1379 if (type.isVoid || type.isFunctionType) { 1378 if (type.isVoid || type.isFunctionType || type.isMalformed) {
1380 return new HTypeConversion(type, kind, backend.dynamicType, this); 1379 return new HTypeConversion(type, kind, backend.dynamicType, this);
1381 } 1380 }
1382 assert(type.isInterfaceType); 1381 assert(type.isInterfaceType);
1383 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { 1382 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) {
1384 // Boolean conversion checks work on non-nullable booleans. 1383 // Boolean conversion checks work on non-nullable booleans.
1385 return new HTypeConversion(type, kind, backend.boolType, this); 1384 return new HTypeConversion(type, kind, backend.boolType, this);
1386 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { 1385 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) {
1387 throw 'creating compound check to $type (this = ${this})'; 1386 throw 'creating compound check to $type (this = ${this})';
1388 } else { 1387 } else {
1389 Entity cls = type.element; 1388 Entity cls = type.element;
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 class HDynamicType extends HRuntimeType { 3474 class HDynamicType extends HRuntimeType {
3476 HDynamicType(DynamicType dartType, TypeMask instructionType) 3475 HDynamicType(DynamicType dartType, TypeMask instructionType)
3477 : super(const <HInstruction>[], dartType, instructionType); 3476 : super(const <HInstruction>[], dartType, instructionType);
3478 3477
3479 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3478 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3480 3479
3481 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3480 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3482 3481
3483 bool typeEquals(HInstruction other) => other is HDynamicType; 3482 bool typeEquals(HInstruction other) => other is HDynamicType;
3484 } 3483 }
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