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

Unified Diff: sdk/lib/_internal/lib/js_helper.dart

Issue 179583002: Revert "Emit named parameter information in declaration order." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/js_helper.dart
diff --git a/sdk/lib/_internal/lib/js_helper.dart b/sdk/lib/_internal/lib/js_helper.dart
index 9eff25f46695f1ed79d049057af774798aeb6bed..cef540b64faed493536f0266130bc1057e14c6d0 100644
--- a/sdk/lib/_internal/lib/js_helper.dart
+++ b/sdk/lib/_internal/lib/js_helper.dart
@@ -366,8 +366,6 @@ class ReflectionInfo {
/// type variables).
final functionType;
- List cachedSortedIndices;
-
ReflectionInfo.internal(this.jsFunction,
this.data,
this.isAccessor,
@@ -414,53 +412,6 @@ class ReflectionInfo {
FIRST_DEFAULT_ARGUMENT, parameter, requiredParameterCount);
}
- /// Returns the default value of the [parameter]th entry of the list of
- /// parameters sorted by name.
- int defaultValueInOrder(int parameter) {
- if (parameter < requiredParameterCount) return null;
-
- if (!areOptionalParametersNamed || optionalParameterCount == 1) {
- return defaultValue(parameter);
- }
-
- int index = sortedIndex(parameter - requiredParameterCount);
- return defaultValue(index);
- }
-
- /// Returns the default value of the [parameter]th entry of the list of
- /// parameters sorted by name.
- String parameterNameInOrder(int parameter) {
- if (parameter < requiredParameterCount) return null;
-
- if (!areOptionalParametersNamed ||
- optionalParameterCount == 1) {
- return parameterName(parameter);
- }
-
- int index = sortedIndex(parameter - requiredParameterCount);
- return parameterName(index);
- }
-
- /// Computes the index of the parameter in the list of named parameters sorted
- /// by their name.
- int sortedIndex(int unsortedIndex) {
- if (cachedSortedIndices == null) {
- // TODO(karlklose): cache this between [ReflectionInfo] instances or cache
- // [ReflectionInfo] instances by [jsFunction].
- cachedSortedIndices = new List(optionalParameterCount);
- Map<String, int> positions = <String, int>{};
- for (int i = 0; i < optionalParameterCount; i++) {
- int index = requiredParameterCount + i;
- positions[parameterName(index)] = index;
- }
- int index = 0;
- (positions.keys.toList()..sort()).forEach((String name) {
- cachedSortedIndices[index++] = positions[name] + requiredParameterCount;
- });
- }
- return cachedSortedIndices[unsortedIndex];
- }
-
@NoInline()
computeFunctionRti(jsConstructor) {
if (JS('bool', 'typeof # == "number"', functionType)) {
@@ -972,10 +923,9 @@ class Primitives {
}
var defaultArguments = new Map();
for (int i = 0; i < info.optionalParameterCount; i++) {
- int index = i + info.requiredParameterCount;
- var parameterName = info.parameterNameInOrder(index);
- var value = info.defaultValueInOrder(index);
- var defaultValue = getMetadata(value);
+ var parameterName = info.parameterName(i + info.requiredParameterCount);
+ var defaultValue =
+ getMetadata(info.defaultValue(i + info.requiredParameterCount));
defaultArguments[parameterName] = defaultValue;
}
bool bad = false;
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698