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

Side by Side Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart

Issue 1062913003: Extract CallStructure from Selector. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
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 // SExpressionUnstringifier implements the inverse operation to 5 // SExpressionUnstringifier implements the inverse operation to
6 // [SExpressionStringifier]. 6 // [SExpressionStringifier].
7 7
8 library sexpr_unstringifier; 8 library sexpr_unstringifier;
9 9
10 import 'package:compiler/src/constants/expressions.dart' 10 import 'package:compiler/src/constants/expressions.dart'
11 show PrimitiveConstantExpression; 11 show PrimitiveConstantExpression;
12 import 'package:compiler/src/constants/values.dart'; 12 import 'package:compiler/src/constants/values.dart';
13 import 'package:compiler/src/dart2jslib.dart' as dart2js 13 import 'package:compiler/src/dart2jslib.dart' as dart2js
14 show MessageKind; 14 show MessageKind;
15 import 'package:compiler/src/dart_types.dart' as dart_types 15 import 'package:compiler/src/dart_types.dart' as dart_types
16 show DartType; 16 show DartType;
17 import 'package:compiler/src/elements/elements.dart' 17 import 'package:compiler/src/elements/elements.dart'
18 show Entity, Element, Elements, Local, TypeVariableElement, ErroneousElement, 18 show Entity, Element, Elements, Local, TypeVariableElement, ErroneousElement,
19 TypeDeclarationElement, ExecutableElement; 19 TypeDeclarationElement, ExecutableElement, PublicName;
20 import 'package:compiler/src/elements/modelx.dart' 20 import 'package:compiler/src/elements/modelx.dart'
21 show ErroneousElementX, TypeVariableElementX; 21 show ErroneousElementX, TypeVariableElementX;
22 import 'package:compiler/src/tree/tree.dart' show LiteralDartString; 22 import 'package:compiler/src/tree/tree.dart' show LiteralDartString;
23 import 'package:compiler/src/universe/universe.dart' 23 import 'package:compiler/src/universe/universe.dart'
24 show Selector, SelectorKind; 24 show Selector, SelectorKind, CallStructure;
25 import 'package:compiler/src/cps_ir/cps_ir_nodes.dart'; 25 import 'package:compiler/src/cps_ir/cps_ir_nodes.dart';
26 26
27 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a 27 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a
28 /// named entity. 28 /// named entity.
29 class DummyEntity extends Entity { 29 class DummyEntity extends Entity {
30 final String name; 30 final String name;
31 DummyEntity(this.name); 31 DummyEntity(this.name);
32 } 32 }
33 33
34 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a 34 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 /// Returns a new named dummy selector with a roughly appropriate kind. 183 /// Returns a new named dummy selector with a roughly appropriate kind.
184 Selector dummySelector(String name, int argumentCount) { 184 Selector dummySelector(String name, int argumentCount) {
185 SelectorKind kind; 185 SelectorKind kind;
186 if (name == "[]") { 186 if (name == "[]") {
187 kind = SelectorKind.INDEX; 187 kind = SelectorKind.INDEX;
188 } else if (Elements.isOperatorName(name)) { 188 } else if (Elements.isOperatorName(name)) {
189 kind = SelectorKind.OPERATOR; 189 kind = SelectorKind.OPERATOR;
190 } else { 190 } else {
191 kind = SelectorKind.CALL; 191 kind = SelectorKind.CALL;
192 } 192 }
193 return new Selector(kind, name, null, argumentCount); 193 return new Selector(kind, new PublicName(name),
194 new CallStructure.unnamed(argumentCount));
194 } 195 }
195 196
196 /// Returns the tokens in s. Note that string literals are not necessarily 197 /// Returns the tokens in s. Note that string literals are not necessarily
197 /// preserved; for instance, "(literalString)" is transformed to 198 /// preserved; for instance, "(literalString)" is transformed to
198 /// " ( literalString ) ". 199 /// " ( literalString ) ".
199 Tokens tokenize(String s) => 200 Tokens tokenize(String s) =>
200 new Tokens( 201 new Tokens(
201 s.replaceAll("(", " ( ") 202 s.replaceAll("(", " ( ")
202 .replaceAll(")", " ) ") 203 .replaceAll(")", " ) ")
203 .replaceAll("{", " { ") 204 .replaceAll("{", " { ")
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return new ReifyTypeVar(type); 730 return new ReifyTypeVar(type);
730 } 731 }
731 732
732 /// (This) 733 /// (This)
733 This parseThis() { 734 This parseThis() {
734 tokens.consumeStart(THIS); 735 tokens.consumeStart(THIS);
735 tokens.consumeEnd(); 736 tokens.consumeEnd();
736 return new This(); 737 return new This();
737 } 738 }
738 } 739 }
OLDNEW
« pkg/compiler/lib/src/universe/universe.dart ('K') | « pkg/compiler/lib/src/util/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698