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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2297283002: create selectors directly from method invocations in kernel -> ssa (Closed)
Patch Set: review Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c3c8355ebc4c14999b9e2caeb76287d1ea4dae9 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,22 @@ 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;
+
+ ir.Name irName = invocation.name;
+ Name name = new Name(
+ irName.name, irName.isPrivate ? getElement(irName.library) : 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) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698