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

Unified Diff: pkg/compiler/lib/src/elements/common.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/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/common.dart
diff --git a/pkg/compiler/lib/src/elements/common.dart b/pkg/compiler/lib/src/elements/common.dart
index 0479c4ef4f289aa88cc8bafc96bf10075c1cc90b..d61a57dc8a4059a2715b509f362ffcb94a11b930 100644
--- a/pkg/compiler/lib/src/elements/common.dart
+++ b/pkg/compiler/lib/src/elements/common.dart
@@ -9,6 +9,7 @@ library elements.common;
import '../common/names.dart' show Identifiers, Names, Uris;
import '../common_elements.dart' show CommonElements;
import '../util/util.dart' show Link;
+import 'entities.dart';
import 'elements.dart';
import 'resolution_types.dart'
show ResolutionDartType, ResolutionInterfaceType, ResolutionFunctionType;
@@ -498,6 +499,8 @@ abstract class ClassElementCommon implements ClassElement {
}
abstract class FunctionSignatureCommon implements FunctionSignature {
+ ParameterStructure _parameterStructure;
+
ResolutionDartType get returnType => type.returnType;
void forEachRequiredParameter(void function(Element parameter)) {
@@ -555,6 +558,24 @@ abstract class FunctionSignatureCommon implements FunctionSignature {
}
return true;
}
+
+ ParameterStructure get parameterStructure {
+ if (_parameterStructure == null) {
+ int requiredParameters = requiredParameterCount;
+ int positionalParameters;
+ List<String> namedParameters;
+ if (optionalParametersAreNamed) {
+ namedParameters = type.namedParameters;
+ positionalParameters = requiredParameters;
+ } else {
+ namedParameters = const <String>[];
+ positionalParameters = requiredParameters + optionalParameterCount;
+ }
+ _parameterStructure = new ParameterStructure(
+ requiredParameters, positionalParameters, namedParameters);
+ }
+ return _parameterStructure;
+ }
}
abstract class MixinApplicationElementCommon
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698