OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library defines runtime operations on objects used by the code | 5 /// This library defines runtime operations on objects used by the code |
6 /// generator. | 6 /// generator. |
7 part of dart._runtime; | 7 part of dart._runtime; |
8 | 8 |
9 _canonicalFieldName(obj, name, args, displayName) => JS('', '''(() => { | 9 _canonicalFieldName(obj, name, args, displayName) => JS('', '''(() => { |
10 $name = $canonicalMember($obj, $name); | 10 $name = $canonicalMember($obj, $name); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 isSubtype($actual, $StreamSubscription)) { | 158 isSubtype($actual, $StreamSubscription)) { |
159 console.warn('Ignoring cast fail from ' + $typeName($actual) + | 159 console.warn('Ignoring cast fail from ' + $typeName($actual) + |
160 ' to ' + $typeName($type)); | 160 ' to ' + $typeName($type)); |
161 return true; | 161 return true; |
162 } | 162 } |
163 return false; | 163 return false; |
164 })()'''); | 164 })()'''); |
165 | 165 |
166 strongInstanceOf(obj, type, ignoreFromWhiteList) => JS('', '''(() => { | 166 strongInstanceOf(obj, type, ignoreFromWhiteList) => JS('', '''(() => { |
167 let actual = $realRuntimeType($obj); | 167 let actual = $realRuntimeType($obj); |
168 if ($isSubtype(actual, $type) || actual == $jsobject) return true; | 168 if ($isSubtype(actual, $type) || actual == $jsobject || |
169 actual == $int && type == $double) return true; | |
Jennifer Messerly
2016/02/10 00:20:30
should we put this logic in isSubtype?
at runtime
vsm
2016/02/11 22:36:06
I thought about doing that, but it's a bigger chan
| |
169 if ($ignoreFromWhiteList == void 0) return false; | 170 if ($ignoreFromWhiteList == void 0) return false; |
170 if ($isGroundType($type)) return false; | 171 if ($isGroundType($type)) return false; |
171 if ($_ignoreTypeFailure(actual, $type)) return true; | 172 if ($_ignoreTypeFailure(actual, $type)) return true; |
172 return false; | 173 return false; |
173 })()'''); | 174 })()'''); |
174 | 175 |
175 instanceOfOrNull(obj, type) => JS('', '''(() => { | 176 instanceOfOrNull(obj, type) => JS('', '''(() => { |
176 if (($obj == null) || $strongInstanceOf($obj, $type, true)) return true; | 177 if (($obj == null) || $strongInstanceOf($obj, $type, true)) return true; |
177 return false; | 178 return false; |
178 })()'''); | 179 })()'''); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 constructor(dartIterator) { | 422 constructor(dartIterator) { |
422 this.dartIterator = dartIterator; | 423 this.dartIterator = dartIterator; |
423 } | 424 } |
424 next() { | 425 next() { |
425 let i = this.dartIterator; | 426 let i = this.dartIterator; |
426 let done = !i.moveNext(); | 427 let done = !i.moveNext(); |
427 return { done: done, value: done ? void 0 : i.current }; | 428 return { done: done, value: done ? void 0 : i.current }; |
428 } | 429 } |
429 } | 430 } |
430 '''); | 431 '''); |
OLD | NEW |