Chromium Code Reviews| Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| index 831db16e27bf98e3fe4845846d609fb69204f418..3504f251fb374f23e5c9f334335c25d12b69d514 100644 |
| --- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| +++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| @@ -358,12 +358,28 @@ class CodeGenerator extends tree_ir.StatementVisitor |
| // Handle some special checks against classes that exist only in |
| // the compile-time class hierarchy, not at runtime. |
| + // TODO(sra): Is this correct? The field tests are only valid with the |
| + // precondtion that [value] is an Array. They will crash on `null`. |
|
Siggi Cherem (dart-lang)
2015/08/21 23:57:11
precondtion => precondition
sra1
2015/08/22 00:11:56
Done.
|
| if (clazz == glue.jsExtendableArrayClass) { |
| + assert(node.isTypeTest); |
| return js.js(r'!#.fixed$length', <js.Expression>[value]); |
| } else if (clazz == glue.jsMutableArrayClass) { |
| + assert(node.isTypeTest); |
| return js.js(r'!#.immutable$list', <js.Expression>[value]); |
| } |
| + if (glue.isStringClass(clazz)) { |
| + if (node.isTypeTest) { |
| + return js.js(r'typeof # === "string"', <js.Expression>[value]); |
| + } |
| + // TODO(sra): Implement fast cast via calling 'stringTypeCast'. |
| + } else if (glue.isBoolClass(clazz)) { |
| + if (node.isTypeTest) { |
| + return js.js(r'typeof # === "boolean"', <js.Expression>[value]); |
| + } |
| + // TODO(sra): Implement fast cast via calling 'boolTypeCast'. |
| + } |
| + |
| // The helper we use needs the JSArray class to exist, but for some |
| // reason the helper does not cause this dependency to be registered. |
| // TODO(asgerf): Most programs need List anyway, but we should fix this. |