| OLD | NEW |
| 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 String typeNameInChrome(obj) { | 5 String typeNameInChrome(obj) { |
| 6 String name = JS('String', "#.constructor.name", obj); | 6 String name = JS('String', "#.constructor.name", obj); |
| 7 if (name == 'Window') return 'DOMWindow'; | 7 if (name == 'Window') return 'DOMWindow'; |
| 8 return name; | 8 return name; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 String tag = inputTable[i][0]; | 250 String tag = inputTable[i][0]; |
| 251 String tags = inputTable[i][1]; | 251 String tags = inputTable[i][1]; |
| 252 Set<String> set = new Set<String>(); | 252 Set<String> set = new Set<String>(); |
| 253 List<String> tagNames = tags.split('|'); | 253 List<String> tagNames = tags.split('|'); |
| 254 for (int j = 0; j < tagNames.length; j++) { | 254 for (int j = 0; j < tagNames.length; j++) { |
| 255 set.add(tagNames[j]); | 255 set.add(tagNames[j]); |
| 256 } | 256 } |
| 257 _dynamicMetadata.add(new MetaInfo(tag, tags, set)); | 257 _dynamicMetadata.add(new MetaInfo(tag, tags, set)); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | |
| 261 // Initialized by the compiler. | |
| 262 var isChecksHelper; | |
| 263 | |
| 264 // This method will be called for 'is' checks on native types. | |
| 265 // It takes the object on which the 'is' check is being done, and the | |
| 266 // property name for the type check. The method patches the real | |
| 267 // prototype of the object with the value from the Dart object | |
| 268 // (see [generateNativeClass]). | |
| 269 bool dynamicIsCheck(obj, String typeName) { | |
| 270 if (isJsArray(obj)) return false; | |
| 271 // Check if the Dart object corresponding to this class has the property. | |
| 272 var res = JS('bool', '!!#[#][#]', isChecksHelper, getTypeNameOf(obj), | |
| 273 typeName); | |
| 274 var proto = JS('var', 'Object.getPrototypeOf(#)', obj); | |
| 275 defineProperty(proto, typeName, res); | |
| 276 return res; | |
| 277 } | |
| OLD | NEW |