Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Side by Side Diff: test/browser/runtime_tests.js

Issue 1145283002: Use short array syntax in method signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/BenchmarkBase.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var assert = chai.assert; 5 var assert = chai.assert;
6 6
7 suite('generic', () => { 7 suite('generic', () => {
8 "use strict"; 8 "use strict";
9 9
10 let generic = dart.generic; 10 let generic = dart.generic;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 Tester() { 437 Tester() {
438 this.f = dart.fn(x => x, core.int, [core.int]); 438 this.f = dart.fn(x => x, core.int, [core.int]);
439 this.me = this; 439 this.me = this;
440 } 440 }
441 m(x, y) {return x;} 441 m(x, y) {return x;}
442 call(x) {return x;} 442 call(x) {return x;}
443 static s(x, y) { return x;} 443 static s(x, y) { return x;}
444 } 444 }
445 dart.setSignature(Tester, { 445 dart.setSignature(Tester, {
446 methods: () => ({ 446 methods: () => ({
447 m: dart.functionType(core.int, [core.int, core.int]), 447 m: [core.int, [core.int, core.int]],
448 call: dart.functionType(core.int, [core.int]) 448 call: [core.int, [core.int]]
449 }), 449 }),
450 statics: () => ({ 450 statics: () => ({
451 s: dart.functionType(core.String, [core.String]) 451 s: [core.String, [core.String]]
452 }), 452 }),
453 names: ['s'] 453 names: ['s']
454 }) 454 })
455 let o = new Tester(); 455 let o = new Tester();
456 456
457 // Method send 457 // Method send
458 assert.equal(dart.dsend(o, 'm', 3, 4), 3); 458 assert.equal(dart.dsend(o, 'm', 3, 4), 3);
459 assert.throws(() => dart.dsend(o, 'm', 3)); 459 assert.throws(() => dart.dsend(o, 'm', 3));
460 assert.throws(() => dart.dsend(o, 'm', "hello", "world")); 460 assert.throws(() => dart.dsend(o, 'm', "hello", "world"));
461 assert.throws(() => dart.dsend(o, 'q', 3)); 461 assert.throws(() => dart.dsend(o, 'q', 3));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 dart.functionType(core.String, [core.List])); 582 dart.functionType(core.String, [core.List]));
583 checkType(c.ListBase.listToString, 583 checkType(c.ListBase.listToString,
584 dart.functionType(core.String, [core.String]), false); 584 dart.functionType(core.String, [core.String]), false);
585 585
586 // Tear off a mixin method 586 // Tear off a mixin method
587 class Base { 587 class Base {
588 m(x) {return x;} 588 m(x) {return x;}
589 }; 589 };
590 dart.setSignature(Base, { 590 dart.setSignature(Base, {
591 methods: () => ({ 591 methods: () => ({
592 m: dart.functionType(core.int, [core.int]), 592 m: [core.int, [core.int]],
593 }) 593 })
594 }); 594 });
595 595
596 class M1 { 596 class M1 {
597 m(x) {return x;} 597 m(x) {return x;}
598 }; 598 };
599 dart.setSignature(M1, { 599 dart.setSignature(M1, {
600 methods: () => ({ 600 methods: () => ({
601 m: dart.functionType(core.num, [core.int]), 601 m: [core.num, [core.int]],
602 }) 602 })
603 }); 603 });
604 604
605 class M2 { 605 class M2 {
606 m(x) {return x;} 606 m(x) {return x;}
607 }; 607 };
608 dart.setSignature(M2, { 608 dart.setSignature(M2, {
609 methods: () => ({ 609 methods: () => ({
610 m: dart.functionType(core.Object, [core.int]), 610 m: [core.Object, [core.int]],
611 }) 611 })
612 }); 612 });
613 613
614 class O extends dart.mixin(Base, M1, M2) { 614 class O extends dart.mixin(Base, M1, M2) {
615 O() {}; 615 O() {};
616 }; 616 };
617 dart.setSignature(O, {}); 617 dart.setSignature(O, {});
618 var obj = new O(); 618 var obj = new O();
619 var m = dart.bind(obj, 'm'); 619 var m = dart.bind(obj, 'm');
620 checkType(m, dart.functionType(core.Object, [core.int])); 620 checkType(m, dart.functionType(core.Object, [core.int]));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 674
675 suite('primitives', function() { 675 suite('primitives', function() {
676 'use strict'; 676 'use strict';
677 677
678 test('fixed length list', () => { 678 test('fixed length list', () => {
679 let list = new core.List(10); 679 let list = new core.List(10);
680 list[0] = 42; 680 list[0] = 42;
681 assert.throws(() => list.add(42)); 681 assert.throws(() => list.add(42));
682 }); 682 });
683 }); 683 });
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/BenchmarkBase.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698