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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 invocation.namedArguments); | 549 invocation.namedArguments); |
550 } | 550 } |
551 // Delegate to the (possibly user-defined) method on the object. | 551 // Delegate to the (possibly user-defined) method on the object. |
552 var extension = getExtensionType(obj); | 552 var extension = getExtensionType(obj); |
553 if (extension != null) { | 553 if (extension != null) { |
554 return JS('', '#[dartx.noSuchMethod](#)', obj, invocation); | 554 return JS('', '#[dartx.noSuchMethod](#)', obj, invocation); |
555 } | 555 } |
556 return JS('', '#.noSuchMethod(#)', obj, invocation); | 556 return JS('', '#.noSuchMethod(#)', obj, invocation); |
557 } | 557 } |
558 | 558 |
| 559 constFn(x) => JS('', '() => x'); |
| 560 |
559 runtimeType(obj) { | 561 runtimeType(obj) { |
560 // Handle primitives where the method isn't on the object. | 562 // Handle primitives where the method isn't on the object. |
561 var result = _checkPrimitiveType(obj); | 563 var result = _checkPrimitiveType(obj); |
562 if (result != null) return wrapType(result); | 564 if (result != null) return wrapType(result); |
563 | 565 |
564 // Delegate to the (possibly user-defined) method on the object. | 566 // Delegate to the (possibly user-defined) method on the object. |
565 var extension = getExtensionType(obj); | 567 var extension = getExtensionType(obj); |
566 if (extension != null) { | 568 if (extension != null) { |
567 return JS('', '#[dartx.runtimeType]', obj); | 569 return JS('', '#[dartx.runtimeType]', obj); |
568 } | 570 } |
(...skipping 17 matching lines...) Expand all Loading... |
586 constructor(dartIterator) { | 588 constructor(dartIterator) { |
587 this.dartIterator = dartIterator; | 589 this.dartIterator = dartIterator; |
588 } | 590 } |
589 next() { | 591 next() { |
590 let i = this.dartIterator; | 592 let i = this.dartIterator; |
591 let done = !i.moveNext(); | 593 let done = !i.moveNext(); |
592 return { done: done, value: done ? void 0 : i.current }; | 594 return { done: done, value: done ? void 0 : i.current }; |
593 } | 595 } |
594 } | 596 } |
595 '''); | 597 '''); |
OLD | NEW |