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

Unified Diff: sdk/lib/_internal/compiler/implementation/js/builder.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js/builder.dart b/sdk/lib/_internal/compiler/implementation/js/builder.dart
index 54924661451afbe5d21a995fef2307daf70a8286..0aa45b70d05e5c98020a5fa6ee6babd5e1a19e51 100644
--- a/sdk/lib/_internal/compiler/implementation/js/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/js/builder.dart
@@ -7,23 +7,13 @@
part of js;
+Expression js(String source) {
ahe 2013/04/05 13:47:20 You could also have JsBuilder implement Function.
+ return new MiniJsParser(source).expression();
+}
+
class JsBuilder {
const JsBuilder();
- Expression operator [](String source) {
- return new MiniJsParser(source).expression();
- }
-
- // TODO(ahe): Remove this method.
- Binary equals(Expression left, Expression right) {
- return new Binary('==', left, right);
- }
-
- // TODO(ahe): Remove this method.
- Binary strictEquals(Expression left, Expression right) {
- return new Binary('===', left, right);
- }
-
LiteralString string(String value) => new LiteralString('"$value"');
If if_(condition, thenPart, [elsePart]) {
@@ -92,7 +82,7 @@ class JsBuilder {
if (expression is Expression) {
return expression;
} else if (expression is String) {
- return this[expression];
+ return js(expression);
} else if (expression is num) {
return new LiteralNumber('$expression');
} else if (expression is bool) {
@@ -134,9 +124,9 @@ class JsBuilder {
Comment comment(String text) => new Comment(text);
}
-const JsBuilder js = const JsBuilder();
+const JsBuilder jsBuilder = const JsBuilder();
-LiteralString string(String value) => js.string(value);
+LiteralString string(String value) => jsBuilder.string(value);
class MiniJsParserError {
MiniJsParserError(this.parser, this.message) { }
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698