Chromium Code Reviews| Index: tool/input_sdk/private/rtti.dart |
| diff --git a/tool/input_sdk/private/rtti.dart b/tool/input_sdk/private/rtti.dart |
| index 8694daa6e38033594b9add6644e6d9d50c09f808..f4d3562f759a3b279d9d66c402e5964986c972cf 100644 |
| --- a/tool/input_sdk/private/rtti.dart |
| +++ b/tool/input_sdk/private/rtti.dart |
| @@ -93,9 +93,20 @@ checkPrimitiveType(obj) => JS('', '''(() => { |
| })()'''); |
| runtimeType(obj) => JS('', '''(() => { |
| + // Lookup primitive (int/double/string) |
| let result = $checkPrimitiveType($obj); |
| if (result !== null) return result; |
| - return $obj.runtimeType; |
| + |
| + // Lookup recorded type |
| + result = $obj.runtimeType; |
|
Jennifer Messerly
2016/02/10 00:20:30
huh, the old code here looks broken. Shouldn't thi
vsm
2016/02/11 22:36:06
For object properties, we either:
(1) use the uns
Jennifer Messerly
2016/02/11 23:04:57
yeah, I mean, this is a bug in how the hand-coded
|
| + if (result) return result; |
| + |
| + // Lookup extension type for native object |
| + result = $obj[$_extensionType]; |
|
Jennifer Messerly
2016/02/10 00:20:30
we can just go with realRuntimeType here, right? T
vsm
2016/02/11 22:36:06
Yeah, was try to avoid the redundant check on prim
|
| + if (result) return result; |
| + |
| + // TODO(vsm): Return JSObject? |
|
Jennifer Messerly
2016/02/10 00:20:30
(this may be moot based on realRuntimeType comment
vsm
2016/02/11 22:36:06
Removed
|
| + return null; |
| })()'''); |
| getFunctionType(obj) => JS('', '''(() => { |
| @@ -111,12 +122,21 @@ getFunctionType(obj) => JS('', '''(() => { |
| /// Currently this will return null for non-Dart objects. |
| /// |
| realRuntimeType(obj) => JS('', '''(() => { |
| + // Lookup primitive type |
| let result = $checkPrimitiveType($obj); |
| if (result !== null) return result; |
| + |
| + // Lookup recorded *real* type (not user definable runtimeType) |
| // TODO(vsm): Should we treat Dart and JS objects differently here? |
| // E.g., we can check if obj instanceof core.Object to differentiate. |
| result = $obj[$_runtimeType]; |
| if (result) return result; |
| + |
| + // Lookup extension type |
| + result = $obj[$_extensionType]; |
|
Jennifer Messerly
2016/02/10 00:20:30
Fallback to the constructor should find our type,
vsm
2016/02/11 22:36:06
Hmm, I think there are (at least) 3 interesting ca
Jennifer Messerly
2016/02/11 23:04:57
This shouldn't happen. setType must be called for
|
| + if (result) return result; |
| + |
| + // Fallback on constructor for class types |
| result = $obj.constructor; |
| if (result == Function) { |
| // An undecorated Function should have come from |