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

Side by Side Diff: tests/language/src/MethodBindingTest.dart

Issue 8914024: frog: better binding of methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/language.status ('k') | tests/language/src/PropertyFieldOverrideTest.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Bind a method to a variable that can be invoked as a function 5 // Bind a method to a variable that can be invoked as a function
6 6
7 class A { 7 class A {
8 int a; 8 int a;
9 9
10 static var func; 10 static var func;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 Expect.equals(4, f13()); 117 Expect.equals(4, f13());
118 118
119 var o14 = new D(14); 119 var o14 = new D(14);
120 Function f14 = o14.getSuper(); 120 Function f14 = o14.getSuper();
121 Expect.equals(14, f14()); 121 Expect.equals(14, f14());
122 122
123 // Assign static field to a function and invoke it. 123 // Assign static field to a function and invoke it.
124 A.func = A.foo; 124 A.func = A.foo;
125 Expect.equals(4, A.func()); 125 Expect.equals(4, A.func());
126 126
127 // bind a function that is possibly native in Javascript.
128 String o15 = 'hithere';
129 var f15 = o15.substring;
130 Expect.equals('i', f15(1, 2));
131
132 var o16 = 'hithere';
133 var f16 = o16.substring;
134 Expect.equals('i', f16(1, 2));
135
136 var f17 = 'hithere'.substring;
137 Expect.equals('i', f17(1, 2));
127 } 138 }
128 139
129 static testMain() { 140 static testMain() {
130 test(); 141 test();
131 } 142 }
132 } 143 }
133 144
134 main() { 145 main() {
135 MethodBindingTest.testMain(); 146 MethodBindingTest.testMain();
136 } 147 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | tests/language/src/PropertyFieldOverrideTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698