Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
index 6450d63440ebc697251e74548bfb3bbc492ff74f..9f2f5e081ed4ee08dc9e878e94232cb612a781ae 100644 |
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
@@ -2475,11 +2475,8 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
js.Expression result = pop(); |
for (TypeVariableType typeVariable in cls.typeVariables) { |
use(node.typeInfoCall); |
- // TODO(johnniwinther): Retrieve the type name properly and not through |
- // [toString]. Note: Two cases below [typeVariable] and |
- // [arguments.head]. |
- js.PropertyAccess field = |
- new js.PropertyAccess.field(pop(), typeVariable.toString()); |
+ int index = RuntimeTypeInformation.getTypeVariableIndex(typeVariable); |
+ js.PropertyAccess field = new js.PropertyAccess.indexed(pop(), index); |
js.Expression genericName = new js.LiteralString("'${arguments.head}'"); |
js.Binary eqTest = new js.Binary('===', field, genericName); |
// Also test for 'undefined' in case the object does not have |
@@ -2487,6 +2484,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
js.Prefix undefinedTest = new js.Prefix('!', field); |
result = new js.Binary( |
'&&', result, new js.Binary('||', undefinedTest, eqTest)); |
+ arguments = arguments.tail; |
} |
push(result, node); |
} |