OLD | NEW |
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 import 'package:compiler/src/constants/values.dart'; | 11 import 'package:compiler/src/constants/values.dart'; |
| 12 import 'package:compiler/src/dart2jslib.dart' as dart2js |
| 13 show MessageKind; |
12 import 'package:compiler/src/dart_types.dart' as dart_types | 14 import 'package:compiler/src/dart_types.dart' as dart_types |
13 show DartType; | 15 show DartType; |
14 import 'package:compiler/src/elements/elements.dart'; | 16 import 'package:compiler/src/elements/elements.dart'; |
15 import 'package:compiler/src/elements/modelx.dart' | 17 import 'package:compiler/src/elements/modelx.dart' |
16 show ErroneousElementX, TypeVariableElementX; | 18 show ErroneousElementX, TypeVariableElementX; |
17 import 'package:compiler/src/messages.dart' | |
18 show MessageKind; | |
19 import 'package:compiler/src/tree/tree.dart' show LiteralDartString; | 19 import 'package:compiler/src/tree/tree.dart' show LiteralDartString; |
20 import 'package:compiler/src/universe/universe.dart' | 20 import 'package:compiler/src/universe/universe.dart' |
21 show Selector, SelectorKind, CallStructure; | 21 show Selector, SelectorKind, CallStructure; |
22 import 'package:compiler/src/cps_ir/cps_ir_nodes.dart'; | 22 import 'package:compiler/src/cps_ir/cps_ir_nodes.dart'; |
23 | 23 |
24 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a | 24 /// Used whenever a node constructed by [SExpressionUnstringifier] needs a |
25 /// named entity. | 25 /// named entity. |
26 class DummyEntity extends Entity { | 26 class DummyEntity extends Entity { |
27 final String name; | 27 final String name; |
28 DummyEntity(this.name); | 28 DummyEntity(this.name); |
(...skipping 12 matching lines...) Expand all Loading... |
41 // that could not be resolved correctly. Perhaps the IR should not rely on | 41 // that could not be resolved correctly. Perhaps the IR should not rely on |
42 // elements at all for naming. | 42 // elements at all for naming. |
43 /// Used whenever a node constructed by [SExpressionUnstringifier] requires | 43 /// Used whenever a node constructed by [SExpressionUnstringifier] requires |
44 /// an [Element] or [FunctionElement]. Extends [ErroneousElementX] since there | 44 /// an [Element] or [FunctionElement]. Extends [ErroneousElementX] since there |
45 /// is currently a large amount of overhead when extending the base abstract | 45 /// is currently a large amount of overhead when extending the base abstract |
46 /// classes, and erroneous elements conveniently also skip several assertion | 46 /// classes, and erroneous elements conveniently also skip several assertion |
47 /// checks in CPS IR nodes that are irrelevant to us. | 47 /// checks in CPS IR nodes that are irrelevant to us. |
48 class DummyElement extends ErroneousElementX | 48 class DummyElement extends ErroneousElementX |
49 implements TypeVariableElement, FieldElement { | 49 implements TypeVariableElement, FieldElement { |
50 DummyElement(String name) | 50 DummyElement(String name) |
51 : super(MessageKind.GENERIC, {}, name, null); | 51 : super(dart2js.MessageKind.GENERIC, {}, name, null); |
52 | 52 |
53 final dart_types.DartType bound = null; | 53 final dart_types.DartType bound = null; |
54 final TypeDeclarationElement typeDeclaration = null; | 54 final TypeDeclarationElement typeDeclaration = null; |
55 | 55 |
56 noSuchMethod(inv) => super.noSuchMethod(inv); | 56 noSuchMethod(inv) => super.noSuchMethod(inv); |
57 } | 57 } |
58 | 58 |
59 /// Used whenever a node constructed by [SExpressionUnstringifier] requires | 59 /// Used whenever a node constructed by [SExpressionUnstringifier] requires |
60 /// a named type. | 60 /// a named type. |
61 class DummyNamedType extends dart_types.DartType { | 61 class DummyNamedType extends dart_types.DartType { |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 tokens.consumeStart(SET_FIELD); | 874 tokens.consumeStart(SET_FIELD); |
875 | 875 |
876 Primitive object = name2variable[tokens.read()]; | 876 Primitive object = name2variable[tokens.read()]; |
877 Element field = new DummyElement(tokens.read()); | 877 Element field = new DummyElement(tokens.read()); |
878 Primitive value = name2variable[tokens.read()]; | 878 Primitive value = name2variable[tokens.read()]; |
879 | 879 |
880 tokens.consumeEnd(); | 880 tokens.consumeEnd(); |
881 return new SetField(object, field, value); | 881 return new SetField(object, field, value); |
882 } | 882 } |
883 } | 883 } |
OLD | NEW |