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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_nodes.dart

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 values.ConstantValue get constant => null; 474 values.ConstantValue get constant => null;
475 475
476 accept(Visitor visitor) => visitor.visitReifyTypeVar(this); 476 accept(Visitor visitor) => visitor.visitReifyTypeVar(this);
477 } 477 }
478 478
479 class LiteralList extends Primitive { 479 class LiteralList extends Primitive {
480 /// The List type being created; this is not the type argument. 480 /// The List type being created; this is not the type argument.
481 final GenericType type; 481 final GenericType type;
482 final List<Reference> values; 482 final List<Reference> values;
483 483
484 LiteralList(this.type, List<Primitive> values) 484 LiteralList(this.type, Iterable<Primitive> values)
485 : this.values = _referenceList(values); 485 : this.values = _referenceList(values);
486 486
487 accept(Visitor visitor) => visitor.visitLiteralList(this); 487 accept(Visitor visitor) => visitor.visitLiteralList(this);
488 } 488 }
489 489
490 class LiteralMap extends Primitive { 490 class LiteralMap extends Primitive {
491 final GenericType type; 491 final GenericType type;
492 final List<Reference> keys; 492 final List<Reference> keys;
493 final List<Reference> values; 493 final List<Reference> values;
494 494
495 LiteralMap(this.type, List<Primitive> keys, List<Primitive> values) 495 LiteralMap(this.type, Iterable<Primitive> keys, Iterable<Primitive> values)
496 : this.keys = _referenceList(keys), 496 : this.keys = _referenceList(keys),
497 this.values = _referenceList(values); 497 this.values = _referenceList(values);
498 498
499 accept(Visitor visitor) => visitor.visitLiteralMap(this); 499 accept(Visitor visitor) => visitor.visitLiteralMap(this);
500 } 500 }
501 501
502 /// Create a non-recursive function. 502 /// Create a non-recursive function.
503 class CreateFunction extends Primitive { 503 class CreateFunction extends Primitive {
504 final FunctionDefinition definition; 504 final FunctionDefinition definition;
505 505
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 accept(Visitor visitor) => visitor.visitFunctionDefinition(this); 560 accept(Visitor visitor) => visitor.visitFunctionDefinition(this);
561 561
562 /// Returns `true` if this function is abstract. 562 /// Returns `true` if this function is abstract.
563 /// 563 ///
564 /// If `true`, [body] and [returnContinuation] are `null` and [localConstants] 564 /// If `true`, [body] and [returnContinuation] are `null` and [localConstants]
565 /// is empty. 565 /// is empty.
566 bool get isAbstract => body == null; 566 bool get isAbstract => body == null;
567 } 567 }
568 568
569 List<Reference> _referenceList(List<Definition> definitions) { 569 List<Reference> _referenceList(Iterable<Definition> definitions) {
570 return definitions.map((e) => new Reference(e)).toList(); 570 return definitions.map((e) => new Reference(e)).toList();
571 } 571 }
572 572
573 abstract class Visitor<T> { 573 abstract class Visitor<T> {
574 T visit(Node node) => node.accept(this); 574 T visit(Node node) => node.accept(this);
575 // Abstract classes. 575 // Abstract classes.
576 T visitNode(Node node) => null; 576 T visitNode(Node node) => null;
577 T visitExpression(Expression node) => visitNode(node); 577 T visitExpression(Expression node) => visitNode(node);
578 T visitDefinition(Definition node) => visitNode(node); 578 T visitDefinition(Definition node) => visitNode(node);
579 T visitPrimitive(Primitive node) => visitDefinition(node); 579 T visitPrimitive(Primitive node) => visitDefinition(node);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 release(node.parameters[i]); 936 release(node.parameters[i]);
937 } 937 }
938 } 938 }
939 939
940 void visitIsTrue(IsTrue node) { 940 void visitIsTrue(IsTrue node) {
941 visitReference(node.value); 941 visitReference(node.value);
942 } 942 }
943 943
944 } 944 }
945 945
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698