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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.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: Address Nicolas' comments. Created 7 years, 3 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 */ 9 */
10 class Namer implements ClosureNamer { 10 class Namer implements ClosureNamer {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return _jsVariableReserved; 175 return _jsVariableReserved;
176 } 176 }
177 177
178 final String CURRENT_ISOLATE; 178 final String CURRENT_ISOLATE;
179 String get GLOBAL_OBJECT => CURRENT_ISOLATE; 179 String get GLOBAL_OBJECT => CURRENT_ISOLATE;
180 180
181 final String getterPrefix = r'get$'; 181 final String getterPrefix = r'get$';
182 final String setterPrefix = r'set$'; 182 final String setterPrefix = r'set$';
183 final String metadataField = '@'; 183 final String metadataField = '@';
184 final String callCatchAllName = r'call$catchAll'; 184 final String callCatchAllName = r'call$catchAll';
185 final String reflectableField = r'$reflectable';
185 186
186 /** 187 /**
187 * Map from top-level or static elements to their unique identifiers provided 188 * Map from top-level or static elements to their unique identifiers provided
188 * by [getName]. 189 * by [getName].
189 * 190 *
190 * Invariant: Keys must be declaration elements. 191 * Invariant: Keys must be declaration elements.
191 */ 192 */
192 final Compiler compiler; 193 final Compiler compiler;
193 final Map<Element, String> globals; 194 final Map<Element, String> globals;
194 final Map<String, LibraryElement> shortPrivateNameOwners; 195 final Map<String, LibraryElement> shortPrivateNameOwners;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 */ 237 */
237 String get STATIC_CLOSURE_NAME_NAME => r'$name'; 238 String get STATIC_CLOSURE_NAME_NAME => r'$name';
238 SourceString get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME; 239 SourceString get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME;
239 bool get shouldMinify => false; 240 bool get shouldMinify => false;
240 241
241 String getNameForJsGetName(Node node, String name) { 242 String getNameForJsGetName(Node node, String name) {
242 switch (name) { 243 switch (name) {
243 case 'GETTER_PREFIX': return getterPrefix; 244 case 'GETTER_PREFIX': return getterPrefix;
244 case 'SETTER_PREFIX': return setterPrefix; 245 case 'SETTER_PREFIX': return setterPrefix;
245 case 'CALL_CATCH_ALL': return callCatchAllName; 246 case 'CALL_CATCH_ALL': return callCatchAllName;
247 case 'REFLECTABLE': return reflectableField;
246 default: 248 default:
247 compiler.reportError( 249 compiler.reportError(
248 node, MessageKind.GENERIC, 250 node, MessageKind.GENERIC,
249 {'text': 'Error: Namer has no name for "$name".'}); 251 {'text': 'Error: Namer has no name for "$name".'});
250 return 'BROKEN'; 252 return 'BROKEN';
251 } 253 }
252 } 254 }
253 255
254 bool isReserved(String name) => name == isolateName; 256 bool isReserved(String name) => name == isolateName;
255 257
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 if (!first) { 1279 if (!first) {
1278 sb.write('_'); 1280 sb.write('_');
1279 } 1281 }
1280 sb.write('_'); 1282 sb.write('_');
1281 visit(link.head); 1283 visit(link.head);
1282 first = true; 1284 first = true;
1283 } 1285 }
1284 } 1286 }
1285 } 1287 }
1286 } 1288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698