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

Side by Side Diff: sdk/lib/_internal/lib/js_mirrors.dart

Issue 246633006: Revert "JS templates" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'dart:collection' show 9 import 'dart:collection' show
10 UnmodifiableListView; 10 UnmodifiableListView;
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 '(function(n){return(function(o){return o[n]()})})(#)', n); 1126 '(function(n){return(function(o){return o[n]()})})(#)', n);
1127 1127
1128 _newInterceptedGetterFn(String name, bool useEval) { 1128 _newInterceptedGetterFn(String name, bool useEval) {
1129 var object = reflectee; 1129 var object = reflectee;
1130 // It is possible that the interceptor for a given object is the object 1130 // It is possible that the interceptor for a given object is the object
1131 // itself, so it is important not to share the code that captures the 1131 // itself, so it is important not to share the code that captures the
1132 // interceptor between multiple different instances of [InstanceMirror]. 1132 // interceptor between multiple different instances of [InstanceMirror].
1133 var interceptor = getInterceptor(object); 1133 var interceptor = getInterceptor(object);
1134 if (!useEval) return _newInterceptGetterNoEvalFn(name, interceptor); 1134 if (!useEval) return _newInterceptGetterNoEvalFn(name, interceptor);
1135 String className = JS('String', '#.constructor.name', interceptor); 1135 String className = JS('String', '#.constructor.name', interceptor);
1136 String functionName = '$className\$$name'; 1136 var body = "(function $className\$$name(o){return i.$name(o)})";
1137 var body = 1137 return JS('', '(function(b,i){return eval(b)})(#,#)', body, interceptor);
1138 '(function(i) {'
1139 ' function $functionName(o){return i.$name(o)}'
1140 ' return $functionName;'
1141 '})';
1142 return JS('', '(function(b){return eval(b)})(#)(#)', body, interceptor);
1143 } 1138 }
1144 1139
1145 _newInterceptGetterNoEvalFn(n, i) => JS('', 1140 _newInterceptGetterNoEvalFn(n, i) => JS('',
1146 '(function(n,i){return(function(o){return i[n](o)})})(#,#)', n, i); 1141 '(function(n,i){return(function(o){return i[n](o)})})(#,#)', n, i);
1147 1142
1148 delegate(Invocation invocation) { 1143 delegate(Invocation invocation) {
1149 return JSInvocationMirror.invokeFromMirror(invocation, reflectee); 1144 return JSInvocationMirror.invokeFromMirror(invocation, reflectee);
1150 } 1145 }
1151 1146
1152 operator ==(other) { 1147 operator ==(other) {
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 // have a part (following a '.') that starts with '_'. 2894 // have a part (following a '.') that starts with '_'.
2900 const int UNDERSCORE = 0x5f; 2895 const int UNDERSCORE = 0x5f;
2901 if (name.isEmpty) return true; 2896 if (name.isEmpty) return true;
2902 int index = -1; 2897 int index = -1;
2903 do { 2898 do {
2904 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; 2899 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
2905 index = name.indexOf('.', index + 1); 2900 index = name.indexOf('.', index + 1);
2906 } while (index >= 0 && index + 1 < name.length); 2901 } while (index >= 0 && index + 1 < name.length);
2907 return true; 2902 return true;
2908 } 2903 }
OLDNEW
« 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