Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
index 7edc8bdea4d689af0a99e2fa6e169f4099b20160..13c17b8723c00aafdaa87f484d85d76c2da00d1b 100644 |
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
@@ -12,6 +12,7 @@ import '../js_backend/js_backend.dart'; |
import '../resolution/tree_elements.dart'; |
import '../tree/tree.dart' as ast; |
import '../types/masks.dart'; |
+import '../universe/call_structure.dart'; |
import '../universe/selector.dart'; |
import '../universe/side_effects.dart'; |
@@ -26,11 +27,19 @@ class KernelAstAdapter { |
final Map<ir.Node, ast.Node> _nodeToAst; |
final Map<ir.Node, Element> _nodeToElement; |
- KernelAstAdapter(this._backend, this._resolvedAst, this._nodeToAst, |
- this._nodeToElement, Map<FunctionElement, ir.Member> functions) { |
+ KernelAstAdapter( |
+ this._backend, |
+ this._resolvedAst, |
+ this._nodeToAst, |
+ this._nodeToElement, |
+ Map<FunctionElement, ir.Member> functions, |
+ Map<LibraryElement, ir.Library> libraries) { |
for (FunctionElement functionElement in functions.keys) { |
_nodeToElement[functions[functionElement]] = functionElement; |
} |
+ for (LibraryElement libraryElement in libraries.keys) { |
+ _nodeToElement[libraries[libraryElement]] = libraryElement; |
+ } |
} |
Compiler get _compiler => _backend.compiler; |
@@ -73,7 +82,27 @@ class KernelAstAdapter { |
// TODO(het): Create the selector directly from the invocation |
Selector getSelector(ir.MethodInvocation invocation) { |
- return _elements.getSelector(getNode(invocation)); |
+ SelectorKind kind = Elements.isOperatorName(invocation.name.name) |
+ ? SelectorKind.OPERATOR |
+ : SelectorKind.CALL; |
+ |
+ // TODO(het): If this is a private name, include the library |
Siggi Cherem (dart-lang)
2016/08/31 17:42:36
remove TODO? Or is this something more than what y
Harry Terkelsen
2016/08/31 17:45:58
Oops! I forgot to remove once I actually did it
|
+ Name name; |
+ if (invocation.name.isPrivate) { |
+ name = |
+ new Name(invocation.name.name, getElement(invocation.name.library)); |
Siggi Cherem (dart-lang)
2016/08/31 17:42:36
minor style nit, consider:
ir.Name irName = invoc
Harry Terkelsen
2016/08/31 17:45:58
Done.
|
+ } else { |
+ name = new Name(invocation.name.name, null); |
+ } |
+ |
+ int argumentCount = invocation.arguments.positional.length + |
+ invocation.arguments.named.length; |
+ List<String> namedArguments = |
+ invocation.arguments.named.map((e) => e.name).toList(); |
+ CallStructure callStructure = |
+ new CallStructure(argumentCount, namedArguments); |
+ |
+ return new Selector(kind, name, callStructure); |
} |
TypeMask getTypeMask(ir.MethodInvocation invocation) { |