| 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 define(['dart_sdk'], function(dart_sdk) { | 5 define(['dart_sdk'], function(dart_sdk) { |
| 6 const assert = chai.assert; | 6 const assert = chai.assert; |
| 7 const async = dart_sdk.async; | 7 const async = dart_sdk.async; |
| 8 const core = dart_sdk.core; | 8 const core = dart_sdk.core; |
| 9 const collection = dart_sdk.collection; | 9 const collection = dart_sdk.collection; |
| 10 const dart = dart_sdk.dart; | 10 const dart = dart_sdk.dart; |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 checkType(dart.bind(mapB, 'forEach'), | 696 checkType(dart.bind(mapB, 'forEach'), |
| 697 dart.fnTypeFuzzy(dart.void, [ | 697 dart.fnTypeFuzzy(dart.void, [ |
| 698 dart.fnTypeFuzzy(dart.void, [core.int, core.int])])); | 698 dart.fnTypeFuzzy(dart.void, [core.int, core.int])])); |
| 699 checkType(dart.bind(mapB, 'forEach'), | 699 checkType(dart.bind(mapB, 'forEach'), |
| 700 dart.fnTypeFuzzy(dart.void, [ | 700 dart.fnTypeFuzzy(dart.void, [ |
| 701 dart.fnTypeFuzzy(dart.void, [core.int, core.String])]), | 701 dart.fnTypeFuzzy(dart.void, [core.int, core.String])]), |
| 702 false, true); | 702 false, true); |
| 703 | 703 |
| 704 // Tear off of a method with a symbol name | 704 // Tear off of a method with a symbol name |
| 705 let listB = new (c.ListBase$(core.int).new)(); | 705 let listB = new (c.ListBase$(core.int).new)(); |
| 706 // List.add is reified as taking Object |
| 706 checkType(dart.bind(listB, dartx.add), | 707 checkType(dart.bind(listB, dartx.add), |
| 707 dart.fnTypeFuzzy(dart.void, [core.int])); | 708 dart.fnTypeFuzzy(dart.void, [core.int])); |
| 708 checkType(dart.bind(listB, dartx.add), | 709 checkType(dart.bind(listB, dartx.add), |
| 709 dart.fnTypeFuzzy(dart.void, [core.String]), false, true); | 710 dart.fnTypeFuzzy(dart.void, [core.String]), true); |
| 711 checkType(dart.bind(listB, dartx.removeAt), |
| 712 dart.fnTypeFuzzy(dart.void, [core.String]), false); |
| 710 | 713 |
| 711 // Tear off of a static method | 714 // Tear off of a static method |
| 712 checkType(c.ListBase.listToString, | 715 checkType(c.ListBase.listToString, |
| 713 dart.fnTypeFuzzy(core.String, [core.List])); | 716 dart.fnTypeFuzzy(core.String, [core.List])); |
| 714 checkType(c.ListBase.listToString, | 717 checkType(c.ListBase.listToString, |
| 715 dart.fnTypeFuzzy(core.String, [core.String]), false, true); | 718 dart.fnTypeFuzzy(core.String, [core.String]), false); |
| 716 | 719 |
| 717 // Tear-off of extension methods on primitives | 720 // Tear-off of extension methods on primitives |
| 718 checkType(dart.bind(3.0, dartx.floor), | 721 checkType(dart.bind(3.0, dartx.floor), |
| 719 dart.fnTypeFuzzy(core.int, [])); | 722 dart.fnTypeFuzzy(core.int, [])); |
| 720 checkType(dart.bind(3.0, dartx.floor), | 723 checkType(dart.bind(3.0, dartx.floor), |
| 721 dart.fnTypeFuzzy(core.String, []), false, true); | 724 dart.fnTypeFuzzy(core.String, []), false); |
| 722 checkType(dart.bind("", dartx.endsWith), | 725 checkType(dart.bind("", dartx.endsWith), |
| 723 dart.fnTypeFuzzy(core.bool, [core.String])); | 726 dart.fnTypeFuzzy(core.bool, [core.String])); |
| 724 checkType(dart.bind("", dartx.endsWith), | 727 checkType(dart.bind("", dartx.endsWith), |
| 725 dart.fnTypeFuzzy(core.bool, [core.int]), false, true); | 728 dart.fnTypeFuzzy(core.bool, [core.int]), false); |
| 726 | 729 |
| 727 // Tear off a mixin method | 730 // Tear off a mixin method |
| 728 class Base { | 731 class Base { |
| 729 m(x) {return x;} | 732 m(x) {return x;} |
| 730 }; | 733 }; |
| 731 dart.setSignature(Base, { | 734 dart.setSignature(Base, { |
| 732 methods: () => ({ | 735 methods: () => ({ |
| 733 m: dart.fnType(core.int, [core.int]), | 736 m: dart.fnType(core.int, [core.int]), |
| 734 }) | 737 }) |
| 735 }); | 738 }); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 list[0] = 42; | 1245 list[0] = 42; |
| 1243 assert.throws(() => list.add(42)); | 1246 assert.throws(() => list.add(42)); |
| 1244 }); | 1247 }); |
| 1245 | 1248 |
| 1246 test('toString on ES Symbol', () => { | 1249 test('toString on ES Symbol', () => { |
| 1247 let sym = Symbol('_foobar'); | 1250 let sym = Symbol('_foobar'); |
| 1248 assert.equal(dart.toString(sym), 'Symbol(_foobar)'); | 1251 assert.equal(dart.toString(sym), 'Symbol(_foobar)'); |
| 1249 }); | 1252 }); |
| 1250 }); | 1253 }); |
| 1251 }); | 1254 }); |
| OLD | NEW |