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

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 944423002: Revert "Use an enum in embedded_names as input to JS_GET_NAME." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_backend.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 String get noSuchMethodName => publicInstanceMethodNameByArity( 294 String get noSuchMethodName => publicInstanceMethodNameByArity(
295 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT); 295 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
296 /** 296 /**
297 * Some closures must contain their name. The name is stored in 297 * Some closures must contain their name. The name is stored in
298 * [STATIC_CLOSURE_NAME_NAME]. 298 * [STATIC_CLOSURE_NAME_NAME].
299 */ 299 */
300 String get STATIC_CLOSURE_NAME_NAME => r'$name'; 300 String get STATIC_CLOSURE_NAME_NAME => r'$name';
301 String get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME; 301 String get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME;
302 bool get shouldMinify => false; 302 bool get shouldMinify => false;
303 303
304 /// Returns the string that is to be used as the result of a call to 304 String getNameForJsGetName(Node node, String name) {
305 /// [JS_GET_NAME] at [node] with argument [name].
306 String getNameForJsGetName(Node node, JsGetName name) {
307 switch (name) { 305 switch (name) {
308 case JsGetName.GETTER_PREFIX: return getterPrefix; 306 case 'GETTER_PREFIX': return getterPrefix;
309 case JsGetName.SETTER_PREFIX: return setterPrefix; 307 case 'SETTER_PREFIX': return setterPrefix;
310 case JsGetName.CALL_PREFIX: return callPrefix; 308 case 'CALL_PREFIX': return callPrefix;
311 case JsGetName.CALL_CATCH_ALL: return callCatchAllName; 309 case 'CALL_CATCH_ALL': return callCatchAllName;
312 case JsGetName.REFLECTABLE: return reflectableField; 310 case 'REFLECTABLE': return reflectableField;
313 case JsGetName.CLASS_DESCRIPTOR_PROPERTY: 311 case 'CLASS_DESCRIPTOR_PROPERTY': return classDescriptorProperty;
314 return classDescriptorProperty; 312 case 'REQUIRED_PARAMETER_PROPERTY': return requiredParameterField;
315 case JsGetName.REQUIRED_PARAMETER_PROPERTY: 313 case 'DEFAULT_VALUES_PROPERTY': return defaultValuesField;
316 return requiredParameterField; 314 case 'CALL_NAME_PROPERTY': return callNameField;
317 case JsGetName.DEFAULT_VALUES_PROPERTY: return defaultValuesField;
318 case JsGetName.CALL_NAME_PROPERTY: return callNameField;
319 default: 315 default:
320 compiler.reportError( 316 compiler.reportError(
321 node, MessageKind.GENERIC, 317 node, MessageKind.GENERIC,
322 {'text': 'Error: Namer has no name for "$name".'}); 318 {'text': 'Error: Namer has no name for "$name".'});
323 return 'BROKEN'; 319 return 'BROKEN';
324 } 320 }
325 } 321 }
326 322
327 String constantName(ConstantValue constant) { 323 String constantName(ConstantValue constant) {
328 // In the current implementation it doesn't make sense to give names to 324 // In the current implementation it doesn't make sense to give names to
329 // function constants since the function-implementation itself serves as 325 // function constants since the function-implementation itself serves as
330 // constant and can be accessed directly. 326 // constant and can be accessed directly.
331 assert(!constant.isFunction); 327 assert(!constant.isFunction);
332 String result = constantNames[constant]; 328 String result = constantNames[constant];
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 if (!first) { 1423 if (!first) {
1428 sb.write('_'); 1424 sb.write('_');
1429 } 1425 }
1430 sb.write('_'); 1426 sb.write('_');
1431 visit(parameter); 1427 visit(parameter);
1432 first = true; 1428 first = true;
1433 } 1429 }
1434 } 1430 }
1435 } 1431 }
1436 } 1432 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_backend.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698