Make is and as checks handle JavaScriptFunction correctly.

BUG=
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1416803002 .
This commit is contained in:
Jacob Richman 2015-10-19 17:58:11 -07:00
parent be1fcb9441
commit f9551da8e3
2 changed files with 7 additions and 8 deletions

View file

@ -3179,8 +3179,9 @@ propertyTypeCast(value, property) {
*/
interceptedTypeCheck(value, property) {
if (value == null) return value;
if ((identical(JS('String', 'typeof #', value), 'object'))
&& JS('bool', '#[#]', getInterceptor(value), property)) {
if ((JS('bool', 'typeof # === "object"', value) ||
JS('bool', 'typeof # === "function"', value)) &&
JS('bool', '#[#]', getInterceptor(value), property)) {
return value;
}
propertyTypeError(value, property);
@ -3192,9 +3193,10 @@ interceptedTypeCheck(value, property) {
* prototype at load time.
*/
interceptedTypeCast(value, property) {
if (value == null
|| ((JS('bool', 'typeof # === "object"', value))
&& JS('bool', '#[#]', getInterceptor(value), property))) {
if (value == null ||
((JS('bool', 'typeof # === "object"', value) ||
JS('bool', 'typeof # === "function"', value)) &&
JS('bool', '#[#]', getInterceptor(value), property))) {
return value;
}
propertyTypeCastError(value, property);

View file

@ -415,6 +415,3 @@ window_nosuchmethod_test: StaticWarning
[ $compiler == dart2js && $cps_ir ]
resource_http_test: Crash # (await for(var b in r.openRead()){bytes.addAll(b);}): await for
[ $compiler == dart2js && $checked ]
js_typed_interop_test/closure: RuntimeError # Issue 24608