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

Side by Side Diff: dart/frog/leg/lib/js_helper.dart

Issue 9426041: Implement .dynamic and throw ObjectNotClosureException in forEach interceptor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/tests/co19/co19-leg.status » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #library('js_helper'); 5 #library('js_helper');
6 6
7 #import('coreimpl.dart'); 7 #import('coreimpl.dart');
8 8
9 #source('date_helper.dart'); 9 #source('date_helper.dart');
10 #source('regexp_helper.dart'); 10 #source('regexp_helper.dart');
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 builtin$clear$0(receiver) { 565 builtin$clear$0(receiver) {
566 checkNull(receiver); 566 checkNull(receiver);
567 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.clear()); 567 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.clear());
568 receiver.length = 0; 568 receiver.length = 0;
569 } 569 }
570 570
571 builtin$forEach$1(receiver, f) { 571 builtin$forEach$1(receiver, f) {
572 checkNull(receiver); 572 checkNull(receiver);
573 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.forEach(f)); 573 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.forEach(f));
574 574
575
kasperl 2012/02/21 07:18:08 Too many newlines.
575 var length = JS("num", @"$0.length", receiver); 576 var length = JS("num", @"$0.length", receiver);
577 if (length > 0 && f === null) throw new ObjectNotClosureException(); // Sigh.
kasperl 2012/02/21 07:18:08 Maybe change 'Sigh' to something more actionable :
576 for (var i = 0; i < length; i++) { 578 for (var i = 0; i < length; i++) {
577 f(JS("Object", @"$0[$1]", receiver, i)); 579 f(JS("Object", @"$0[$1]", receiver, i));
578 } 580 }
579 } 581 }
580 582
581 builtin$getRange$2(receiver, start, length) { 583 builtin$getRange$2(receiver, start, length) {
582 checkNull(receiver); 584 checkNull(receiver);
583 if (!isJsArray(receiver)) { 585 if (!isJsArray(receiver)) {
584 return UNINTERCEPTED(receiver.getRange(start, length)); 586 return UNINTERCEPTED(receiver.getRange(start, length));
585 } 587 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 builtin$hashCode$0(receiver) { 1148 builtin$hashCode$0(receiver) {
1147 if (receiver is num) return receiver & 0x1FFFFFFF; 1149 if (receiver is num) return receiver & 0x1FFFFFFF;
1148 if (receiver is String) { 1150 if (receiver is String) {
1149 throw 'String.hashCode is not implemented'; 1151 throw 'String.hashCode is not implemented';
1150 } 1152 }
1151 if (isJsArray(receiver)) { 1153 if (isJsArray(receiver)) {
1152 throw 'List.hashCode is not implemented'; 1154 throw 'List.hashCode is not implemented';
1153 } 1155 }
1154 return UNINTERCEPTED(receiver.hashCode()); 1156 return UNINTERCEPTED(receiver.hashCode());
1155 } 1157 }
1158
1159 // TODO(ahe): Dynamic may be overridden.
1160 builtin$get$dynamic(receiver) => receiver;
OLDNEW
« no previous file with comments | « no previous file | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698