Chromium Code Reviews| Index: lib/compiler/implementation/lib/js_helper.dart |
| diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart |
| index 1027a46bae0699588e200b47cc0e574c0affbd01..d2a5c030948b79526dce820b62d65c504563828b 100644 |
| --- a/lib/compiler/implementation/lib/js_helper.dart |
| +++ b/lib/compiler/implementation/lib/js_helper.dart |
| @@ -370,17 +370,22 @@ class Primitives { |
| * by defining a function in JavaScript called "dartPrint". |
| */ |
| static void printString(String string) { |
| - var hasDartPrint = JS('bool', @'typeof dartPrint == "function"'); |
| + bool hasDartPrint = JS('bool', @'typeof dartPrint == "function"'); |
|
Emily Fortuna
2012/07/05 11:46:42
nit: the style guide suggests having leaving varia
kasperl
2012/07/05 11:49:03
Done.
|
| if (hasDartPrint) { |
| JS('void', @'dartPrint(#)', string); |
| - } else { |
| - var hasConsole = JS('bool', @'typeof console == "object"'); |
| - if (hasConsole) { |
| - JS('void', @'console.log(#)', string); |
| - } else { |
| - JS('void', @'write(#)', string); |
| - JS('void', @'write("\n")'); |
| - } |
| + return; |
| + } |
| + |
| + bool hasConsole = JS('bool', @'typeof console == "object"'); |
|
Emily Fortuna
2012/07/05 11:46:42
nit: personally I'd write this as
if (hasDartPrin
kasperl
2012/07/05 11:49:03
In this case, I think the JS expressions are a bit
|
| + if (hasConsole) { |
| + JS('void', @'console.log(#)', string); |
| + return; |
| + } |
| + |
| + bool hasWrite = JS('bool', @'typeof write == "function"'); |
| + if (hasWrite) { |
| + JS('void', @'write(#)', string); |
| + JS('void', @'write("\n")'); |
| } |
| } |