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

Side by Side Diff: frog/lib/corelib.dart

Issue 9302012: Better way to fix console.log in IE. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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
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("dart:core"); 5 #library("dart:core");
6 #import("dart:coreimpl"); 6 #import("dart:coreimpl");
7 7
8 // TODO(jimhug): Better way to map in standard corelib 8 // TODO(jimhug): Better way to map in standard corelib
9 #source("../../corelib/src/bool.dart"); 9 #source("../../corelib/src/bool.dart");
10 #source("../../corelib/src/collection.dart"); 10 #source("../../corelib/src/collection.dart");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 /** Returns the frequency of clock ticks in Hz. */ 52 /** Returns the frequency of clock ticks in Hz. */
53 // TODO(jimhug): Why isn't this a property? 53 // TODO(jimhug): Why isn't this a property?
54 static int frequency() => 1000; 54 static int frequency() => 1000;
55 } 55 }
56 56
57 // TODO(jmesserly): this is working around a name conflict with "window.print". 57 // TODO(jmesserly): this is working around a name conflict with "window.print".
58 void print(Object obj) => _print(obj); 58 void print(Object obj) => _print(obj);
59 void _print(Object obj) native @'''if (typeof console == 'object') { 59 void _print(Object obj) native @'''if (typeof console == 'object') {
60 if (obj) obj = obj.toString(); 60 if (obj) obj = obj.toString();
61 console.log(obj); 61 console.log(obj);
62 } else { 62 } else if (typeof write === 'function') {
63 write(obj); 63 write(obj);
64 write('\n'); 64 write('\n');
65 }''' { 65 }''' {
66 // ensure toString is generated 66 // ensure toString is generated
67 obj.toString(); 67 obj.toString();
68 } 68 }
69 69
70 // Exceptions thrown by the generated JS code. 70 // Exceptions thrown by the generated JS code.
71 71
72 class AssertionError { 72 class AssertionError {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // TODO(jmesserly): add named args. For now stay compatible with the VM. 126 // TODO(jmesserly): add named args. For now stay compatible with the VM.
127 noSuchMethod(String name, List args) { 127 noSuchMethod(String name, List args) {
128 throw new NoSuchMethodException(this, name, args); 128 throw new NoSuchMethodException(this, name, args);
129 } 129 }
130 } 130 }
131 131
132 void _assert(var test, String text, String url, int line, int column) { 132 void _assert(var test, String text, String url, int line, int column) {
133 if (test is Function) test = test(); 133 if (test is Function) test = test();
134 if (!test) throw new AssertionError._internal(text, url, line, column); 134 if (!test) throw new AssertionError._internal(text, url, line, column);
135 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698