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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart

Issue 13704004: dart2js: Use js('source') instead of js['source'] to invoke JS mini-parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantInitializerEmitter _initializerEmitter; 9 ConstantInitializerEmitter _initializerEmitter;
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } else if (value == -double.INFINITY) { 86 } else if (value == -double.INFINITY) {
87 return new jsAst.LiteralNumber("(-1/0)"); 87 return new jsAst.LiteralNumber("(-1/0)");
88 } else { 88 } else {
89 return new jsAst.LiteralNumber("$value"); 89 return new jsAst.LiteralNumber("$value");
90 } 90 }
91 } 91 }
92 92
93 jsAst.Expression visitTrue(TrueConstant constant) { 93 jsAst.Expression visitTrue(TrueConstant constant) {
94 if (compiler.enableMinification) { 94 if (compiler.enableMinification) {
95 // Use !0 for true. 95 // Use !0 for true.
96 return js["!0"]; 96 return js("!0");
97 } else { 97 } else {
98 return new jsAst.LiteralBool(true); 98 return new jsAst.LiteralBool(true);
99 } 99 }
100 } 100 }
101 101
102 jsAst.Expression visitFalse(FalseConstant constant) { 102 jsAst.Expression visitFalse(FalseConstant constant) {
103 if (compiler.enableMinification) { 103 if (compiler.enableMinification) {
104 // Use !1 for false. 104 // Use !1 for false.
105 return js["!1"]; 105 return js("!1");
106 } else { 106 } else {
107 return new jsAst.LiteralBool(false); 107 return new jsAst.LiteralBool(false);
108 } 108 }
109 } 109 }
110 110
111 /** 111 /**
112 * Write the contents of the quoted string to a [CodeBuffer] in 112 * Write the contents of the quoted string to a [CodeBuffer] in
113 * a form that is valid as JavaScript string literal content. 113 * a form that is valid as JavaScript string literal content.
114 * The string is assumed quoted by double quote characters. 114 * The string is assumed quoted by double quote characters.
115 */ 115 */
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 List<jsAst.Expression> _array(List<Constant> values) { 312 List<jsAst.Expression> _array(List<Constant> values) {
313 List<jsAst.Expression> valueList = <jsAst.Expression>[]; 313 List<jsAst.Expression> valueList = <jsAst.Expression>[];
314 for (int i = 0; i < values.length; i++) { 314 for (int i = 0; i < values.length; i++) {
315 valueList.add(_reference(values[i])); 315 valueList.add(_reference(values[i]));
316 } 316 }
317 return valueList; 317 return valueList;
318 } 318 }
319 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698