@@ -12,6 +12,7 @@ import '../js_backend/js_backend.dart';
12
12
import '../resolution/tree_elements.dart' ;
13
13
import '../tree/tree.dart' as ast;
14
14
import '../types/masks.dart' ;
15
+ import '../universe/call_structure.dart' ;
15
16
import '../universe/selector.dart' ;
16
17
import '../universe/side_effects.dart' ;
17
18
@@ -26,11 +27,19 @@ class KernelAstAdapter {
26
27
final Map <ir.Node , ast.Node > _nodeToAst;
27
28
final Map <ir.Node , Element > _nodeToElement;
28
29
29
- KernelAstAdapter (this ._backend, this ._resolvedAst, this ._nodeToAst,
30
- this ._nodeToElement, Map <FunctionElement , ir.Member > functions) {
30
+ KernelAstAdapter (
31
+ this ._backend,
32
+ this ._resolvedAst,
33
+ this ._nodeToAst,
34
+ this ._nodeToElement,
35
+ Map <FunctionElement , ir.Member > functions,
36
+ Map <LibraryElement , ir.Library > libraries) {
31
37
for (FunctionElement functionElement in functions.keys) {
32
38
_nodeToElement[functions[functionElement]] = functionElement;
33
39
}
40
+ for (LibraryElement libraryElement in libraries.keys) {
41
+ _nodeToElement[libraries[libraryElement]] = libraryElement;
42
+ }
34
43
}
35
44
36
45
Compiler get _compiler => _backend.compiler;
@@ -73,7 +82,22 @@ class KernelAstAdapter {
73
82
74
83
// TODO(het): Create the selector directly from the invocation
75
84
Selector getSelector (ir.MethodInvocation invocation) {
76
- return _elements.getSelector (getNode (invocation));
85
+ SelectorKind kind = Elements .isOperatorName (invocation.name.name)
86
+ ? SelectorKind .OPERATOR
87
+ : SelectorKind .CALL ;
88
+
89
+ ir.Name irName = invocation.name;
90
+ Name name = new Name (
91
+ irName.name, irName.isPrivate ? getElement (irName.library) : null );
92
+
93
+ int argumentCount = invocation.arguments.positional.length +
94
+ invocation.arguments.named.length;
95
+ List <String > namedArguments =
96
+ invocation.arguments.named.map ((e) => e.name).toList ();
97
+ CallStructure callStructure =
98
+ new CallStructure (argumentCount, namedArguments);
99
+
100
+ return new Selector (kind, name, callStructure);
77
101
}
78
102
79
103
TypeMask getTypeMask (ir.MethodInvocation invocation) {
0 commit comments