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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 743973002: Add list literals in js cps codegen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 6 years, 1 month 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 | pkg/compiler/lib/src/js_backend/codegen/glue.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir;
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 @override 170 @override
171 js.Expression visitInvokeSuperMethod(tree_ir.InvokeSuperMethod node) { 171 js.Expression visitInvokeSuperMethod(tree_ir.InvokeSuperMethod node) {
172 return giveup(node); 172 return giveup(node);
173 // TODO: implement visitInvokeSuperMethod 173 // TODO: implement visitInvokeSuperMethod
174 } 174 }
175 175
176 @override 176 @override
177 js.Expression visitLiteralList(tree_ir.LiteralList node) { 177 js.Expression visitLiteralList(tree_ir.LiteralList node) {
178 return giveup(node); 178 registry.registerInstantiatedClass(glue.listClass);
179 // TODO: implement visitLiteralList 179 int length = node.values.length;
180 List<js.ArrayElement> entries = new List<js.ArrayElement>.generate(length,
181 (int i) => new js.ArrayElement(i, visitExpression(node.values[i])));
182 return new js.ArrayInitializer(length, entries);
180 } 183 }
181 184
182 @override 185 @override
183 js.Expression visitLiteralMap(tree_ir.LiteralMap node) { 186 js.Expression visitLiteralMap(tree_ir.LiteralMap node) {
184 return giveup(node); 187 return giveup(node);
185 // TODO: implement visitLiteralMap 188 // TODO: implement visitLiteralMap
186 } 189 }
187 190
188 @override 191 @override
189 js.Expression visitLogicalOperator(tree_ir.LogicalOperator node) { 192 js.Expression visitLogicalOperator(tree_ir.LogicalOperator node) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 284 }
282 285
283 @override 286 @override
284 void visitReturn(tree_ir.Return node) { 287 void visitReturn(tree_ir.Return node) {
285 accumulator.add(new js.Return(visitExpression(node.value))); 288 accumulator.add(new js.Return(visitExpression(node.value)));
286 } 289 }
287 290
288 bool isNullLiteral(js.Expression exp) => exp is js.LiteralNull; 291 bool isNullLiteral(js.Expression exp) => exp is js.LiteralNull;
289 292
290 } 293 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698