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

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

Issue 23045004: Throw when reflecting on elements not covered by a `MirrorsUsed` annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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 412c9b40ae72f03a7c677d99a716d6d83c702899..48f464db3a6798590a70021dc2b57c5639d3aeee 100644
--- a/sdk/lib/_internal/lib/js_helper.dart
+++ b/sdk/lib/_internal/lib/js_helper.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -99,7 +99,7 @@ class JSInvocationMirror implements Invocation {
final List _arguments;
final List _namedArgumentNames;
/** Map from argument name to index in _arguments. */
- Map<String,dynamic> _namedIndices = null;
+ Map<String, dynamic> _namedIndices = null;
JSInvocationMirror(this._memberName,
this._internalName,
@@ -135,7 +135,7 @@ class JSInvocationMirror implements Invocation {
return makeLiteralListConst(list);
}
- Map<Symbol,dynamic> get namedArguments {
+ Map<Symbol, dynamic> get namedArguments {
// TODO: Make maps const (issue 10471)
if (isAccessor) return <Symbol, dynamic>{};
int namedArgumentCount = _namedArgumentNames.length;
@@ -170,6 +170,9 @@ class JSInvocationMirror implements Invocation {
}
var method = JS('var', '#[#]', receiver, name);
if (JS('String', 'typeof #', method) == 'function') {
+ if (JS('bool', r'#.$reflectable == false', method)) {
ngeoffray 2013/08/29 07:45:49 Use JS_GET_NAME.
karlklose 2013/08/29 15:33:37 Done.
+ throw new UnsupportedError('reflection on ${memberName}');
ngeoffray 2013/08/29 07:45:49 Maybe add a bit more explanation in the error mess
karlklose 2013/08/29 15:33:37 Done.
+ }
return new CachedInvocation(method, isIntercepted, interceptor);
} else {
// In this case, receiver doesn't implement name. So we should

Powered by Google App Engine
This is Rietveld 408576698