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

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

Issue 1200403003: 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') | tests/co19/co19-co19.status » ('j') | 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 4270ab576d2e43084f28ac99258d89c433f6be9a..ca53762e2c5d540d72f762d14fbd263e2c81d9dc 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -300,21 +300,20 @@ class JSInvocationMirror implements Invocation {
for (var index = 0 ; index < argumentCount ; index++) {
list.add(_arguments[index]);
}
- return makeLiteralListConst(list);
+ return JSArray.markUnmodifiableList(list);
}
Map<Symbol, dynamic> get namedArguments {
- // TODO: Make maps const (issue 10471)
- if (isAccessor) return <Symbol, dynamic>{};
+ if (isAccessor) return const <Symbol, dynamic>{};
int namedArgumentCount = _namedArgumentNames.length;
int namedArgumentsStartIndex = _arguments.length - namedArgumentCount;
- if (namedArgumentCount == 0) return <Symbol, dynamic>{};
+ if (namedArgumentCount == 0) return const <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 map;
+ return new ConstantMapView<Symbol, dynamic>(map);
}
_getCachedInvocation(Object object) {
@@ -1505,12 +1504,6 @@ 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') | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698