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

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

Issue 237583014: JS templates (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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 | « sdk/lib/_internal/lib/js_helper.dart ('k') | tests/compiler/dart2js/js_parser_statements_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index 1036bfdb25540a67d5e265feb3ca4b8c3aefdfed..e2da31dbb38a44b226957697d5766d87b2a6eb00 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -1133,8 +1133,13 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
var interceptor = getInterceptor(object);
if (!useEval) return _newInterceptGetterNoEvalFn(name, interceptor);
String className = JS('String', '#.constructor.name', interceptor);
- var body = "(function $className\$$name(o){return i.$name(o)})";
- return JS('', '(function(b,i){return eval(b)})(#,#)', body, interceptor);
+ String functionName = '$className\$$name';
+ var body =
+ '(function(i) {'
+ ' function $functionName(o){return i.$name(o)}'
+ ' return $functionName;'
+ '})';
+ return JS('', '(function(b){return eval(b)})(#)(#)', body, interceptor);
}
_newInterceptGetterNoEvalFn(n, i) => JS('',
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | tests/compiler/dart2js/js_parser_statements_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698