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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart

Issue 1616143003: Lower map literals to constructor or function calls in builder (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 tree_ir_tracer; 5 library tree_ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'tree_ir_nodes.dart'; 9 import 'tree_ir_nodes.dart';
10 10
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 String name = node.selector.name; 407 String name = node.selector.name;
408 String args = formatArguments(node); 408 String args = formatArguments(node);
409 return "oneshot $name($args)"; 409 return "oneshot $name($args)";
410 } 410 }
411 411
412 String visitLiteralList(LiteralList node) { 412 String visitLiteralList(LiteralList node) {
413 String values = node.values.map(visitExpression).join(', '); 413 String values = node.values.map(visitExpression).join(', ');
414 return "list [$values]"; 414 return "list [$values]";
415 } 415 }
416 416
417 String visitLiteralMap(LiteralMap node) {
418 List<String> entries = new List<String>();
419 node.entries.forEach((LiteralMapEntry entry) {
420 String key = visitExpression(entry.key);
421 String value = visitExpression(entry.value);
422 entries.add("$key: $value");
423 });
424 return "map [${entries.join(', ')}]";
425 }
426
427 String visitConstant(Constant node) { 417 String visitConstant(Constant node) {
428 return "${node.value.toStructuredString()}"; 418 return "${node.value.toStructuredString()}";
429 } 419 }
430 420
431 String visitThis(This node) { 421 String visitThis(This node) {
432 return "this"; 422 return "this";
433 } 423 }
434 424
435 static bool usesInfixNotation(Expression node) { 425 static bool usesInfixNotation(Expression node) {
436 return node is Conditional || 426 return node is Conditional ||
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 608 String prefix = v.element == null ? 'v' : '${v.element.name}_';
619 while (name == null || _usedNames.contains(name)) { 609 while (name == null || _usedNames.contains(name)) {
620 name = "$prefix${_counter++}"; 610 name = "$prefix${_counter++}";
621 } 611 }
622 _names[v] = name; 612 _names[v] = name;
623 _usedNames.add(name); 613 _usedNames.add(name);
624 } 614 }
625 return name; 615 return name;
626 } 616 }
627 } 617 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/cps_ir/expected/basic_1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698