| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 452 } |
| 453 | 453 |
| 454 var extension = getExtensionType(obj); | 454 var extension = getExtensionType(obj); |
| 455 if (extension != null) { | 455 if (extension != null) { |
| 456 return JS('', '#[dartx.hashCode]', obj); | 456 return JS('', '#[dartx.hashCode]', obj); |
| 457 } | 457 } |
| 458 return JS('', '#.hashCode', obj); | 458 return JS('', '#.hashCode', obj); |
| 459 } | 459 } |
| 460 | 460 |
| 461 @JSExportName('toString') | 461 @JSExportName('toString') |
| 462 _toString(obj) { | 462 String _toString(obj) { |
| 463 if (obj == null) return "null"; | 463 if (obj == null) return "null"; |
| 464 | 464 |
| 465 var extension = getExtensionType(obj); | 465 var extension = getExtensionType(obj); |
| 466 if (extension != null) { | 466 if (extension != null) { |
| 467 return JS('', '#[dartx.toString]()', obj); | 467 return JS('String', '#[dartx.toString]()', obj); |
| 468 } | 468 } |
| 469 return JS('', '"" + #', obj); | 469 // TODO(jmesserly): restore this faster path once ES Symbol is treated as |
| 470 // an extension type (and thus hits the above code path). |
| 471 // See https://github.com/dart-lang/dev_compiler/issues/578. |
| 472 // return JS('', '"" + #', obj); |
| 473 return JS('String', '#.toString()', obj); |
| 470 } | 474 } |
| 471 | 475 |
| 472 // TODO(jmesserly): is the argument type verified statically? | 476 // TODO(jmesserly): is the argument type verified statically? |
| 473 noSuchMethod(obj, Invocation invocation) { | 477 noSuchMethod(obj, Invocation invocation) { |
| 474 if (obj == null) { | 478 if (obj == null) { |
| 475 throw new NoSuchMethodError( | 479 throw new NoSuchMethodError( |
| 476 null, | 480 null, |
| 477 invocation.memberName, | 481 invocation.memberName, |
| 478 invocation.positionalArguments, | 482 invocation.positionalArguments, |
| 479 invocation.namedArguments); | 483 invocation.namedArguments); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 constructor(dartIterator) { | 520 constructor(dartIterator) { |
| 517 this.dartIterator = dartIterator; | 521 this.dartIterator = dartIterator; |
| 518 } | 522 } |
| 519 next() { | 523 next() { |
| 520 let i = this.dartIterator; | 524 let i = this.dartIterator; |
| 521 let done = !i.moveNext(); | 525 let done = !i.moveNext(); |
| 522 return { done: done, value: done ? void 0 : i.current }; | 526 return { done: done, value: done ? void 0 : i.current }; |
| 523 } | 527 } |
| 524 } | 528 } |
| 525 '''); | 529 '''); |
| OLD | NEW |