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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js/builder.dart

Issue 24493006: Implement named arguments in InstanceMirror.invoke. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweaked test to get a little test coverage Created 7 years, 2 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/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Utilities for building JS ASTs at runtime. Contains a builder class 5 // Utilities for building JS ASTs at runtime. Contains a builder class
6 // and a parser that parses part of the language. 6 // and a parser that parses part of the language.
7 7
8 part of js; 8 part of js;
9 9
10 class JsBuilder { 10 class JsBuilder {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return this(expression); 122 return this(expression);
123 } else if (expression is num) { 123 } else if (expression is num) {
124 return new LiteralNumber('$expression'); 124 return new LiteralNumber('$expression');
125 } else if (expression is bool) { 125 } else if (expression is bool) {
126 return new LiteralBool(expression); 126 return new LiteralBool(expression);
127 } else if (expression is Map) { 127 } else if (expression is Map) {
128 if (!expression.isEmpty) { 128 if (!expression.isEmpty) {
129 throw new ArgumentError('expression should be an empty Map'); 129 throw new ArgumentError('expression should be an empty Map');
130 } 130 }
131 return new ObjectInitializer([]); 131 return new ObjectInitializer([]);
132 } else if (expression is List) {
133 var values = new List<ArrayElement>(expression.length);
134 int index = 0;
135 for (var entry in expression) {
136 values[index] = new ArrayElement(index, toExpression(entry));
137 index++;
138 }
139 return new ArrayInitializer(values.length, values);
132 } else { 140 } else {
133 throw new ArgumentError('expression should be an Expression, ' 141 throw new ArgumentError('expression should be an Expression, '
134 'a String, a num, a bool, or a Map'); 142 'a String, a num, a bool, or a Map');
135 } 143 }
136 } 144 }
137 145
138 ForIn forIn(String name, object, statement) { 146 ForIn forIn(String name, object, statement) {
139 return new ForIn(defineVar(name), 147 return new ForIn(defineVar(name),
140 toExpression(object), 148 toExpression(object),
141 toStatement(statement)); 149 toStatement(statement));
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 796 }
789 797
790 Node visitLiteralNull(LiteralNull node) { 798 Node visitLiteralNull(LiteralNull node) {
791 return node; 799 return node;
792 } 800 }
793 801
794 Node visitLiteralBool(LiteralBool node) { 802 Node visitLiteralBool(LiteralBool node) {
795 return node; 803 return node;
796 } 804 }
797 } 805 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698