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

Unified Diff: pkg/compiler/lib/src/kernel/world_builder.dart

Issue 2809603002: Introduce ParameterStructure (Closed)
Patch Set: Fix. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/kernel/elements.dart ('k') | pkg/compiler/lib/src/resolution/class_hierarchy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/world_builder.dart
diff --git a/pkg/compiler/lib/src/kernel/world_builder.dart b/pkg/compiler/lib/src/kernel/world_builder.dart
index 08c4929158093943e18a57423b399101ca4d6c9e..15c9637470761f8f47ad6c0cb3af7f7a3b4ed443 100644
--- a/pkg/compiler/lib/src/kernel/world_builder.dart
+++ b/pkg/compiler/lib/src/kernel/world_builder.dart
@@ -193,6 +193,16 @@ class KernelWorldBuilder extends KernelElementAdapterMixin {
});
}
+ ParameterStructure _getParameterStructure(ir.FunctionNode node) {
+ // TODO(johnniwinther): Cache the computed function type.
+ int requiredParameters = node.requiredParameterCount;
+ int positionalParameters = node.positionalParameters.length;
+ List<String> namedParameters =
+ node.namedParameters.map((p) => p.name).toList()..sort();
+ return new ParameterStructure(
+ requiredParameters, positionalParameters, namedParameters);
+ }
+
KConstructor _getConstructor(ir.Member node) {
return _constructorMap.putIfAbsent(node, () {
int memberIndex = _memberList.length;
@@ -200,12 +210,14 @@ class KernelWorldBuilder extends KernelElementAdapterMixin {
KClass enclosingClass = _getClass(node.enclosingClass);
Name name = getName(node.name);
bool isExternal = node.isExternal;
+
if (node is ir.Constructor) {
- constructor = new KGenerativeConstructor(
- memberIndex, enclosingClass, name,
+ constructor = new KGenerativeConstructor(memberIndex, enclosingClass,
+ name, _getParameterStructure(node.function),
isExternal: isExternal, isConst: node.isConst);
} else if (node is ir.Procedure) {
constructor = new KFactoryConstructor(memberIndex, enclosingClass, name,
+ _getParameterStructure(node.function),
isExternal: isExternal, isConst: node.isConst);
} else {
// TODO(johnniwinther): Convert `node.location` to a [SourceSpan].
@@ -245,6 +257,7 @@ class KernelWorldBuilder extends KernelElementAdapterMixin {
case ir.ProcedureKind.Method:
case ir.ProcedureKind.Operator:
function = new KMethod(memberIndex, library, enclosingClass, name,
+ _getParameterStructure(node.function),
isStatic: isStatic,
isExternal: isExternal,
isAbstract: isAbstract);
« no previous file with comments | « pkg/compiler/lib/src/kernel/elements.dart ('k') | pkg/compiler/lib/src/resolution/class_hierarchy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698