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

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

Issue 1207723003: Revert "JSInvocationMirror - return unmodifiable list or map" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/js_lib/constant_map.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index ca53762e2c5d540d72f762d14fbd263e2c81d9dc..4270ab576d2e43084f28ac99258d89c433f6be9a 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -300,20 +300,21 @@ class JSInvocationMirror implements Invocation {
for (var index = 0 ; index < argumentCount ; index++) {
list.add(_arguments[index]);
}
- return JSArray.markUnmodifiableList(list);
+ return makeLiteralListConst(list);
}
Map<Symbol, dynamic> get namedArguments {
- if (isAccessor) return const <Symbol, dynamic>{};
+ // TODO: Make maps const (issue 10471)
+ if (isAccessor) return <Symbol, dynamic>{};
int namedArgumentCount = _namedArgumentNames.length;
int namedArgumentsStartIndex = _arguments.length - namedArgumentCount;
- if (namedArgumentCount == 0) return const <Symbol, dynamic>{};
+ if (namedArgumentCount == 0) return <Symbol, dynamic>{};
var map = new Map<Symbol, dynamic>();
for (int i = 0; i < namedArgumentCount; i++) {
map[new _symbol_dev.Symbol.unvalidated(_namedArgumentNames[i])] =
_arguments[namedArgumentsStartIndex + i];
}
- return new ConstantMapView<Symbol, dynamic>(map);
+ return map;
}
_getCachedInvocation(Object object) {
@@ -1504,6 +1505,12 @@ throwExpression(ex) {
JS('void', 'throw #', wrapException(ex));
}
+makeLiteralListConst(list) {
+ JS('bool', r'#.immutable$list = #', list, true);
+ JS('bool', r'#.fixed$length = #', list, true);
+ return list;
+}
+
throwRuntimeError(message) {
throw new RuntimeError(message);
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/constant_map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698