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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart

Issue 170103003: Avoid use of empty string as a property name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 /** 8 /**
9 * Documentation wanted -- johnniwinther 9 * Documentation wanted -- johnniwinther
10 * 10 *
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 String runtimeName = 30 String runtimeName =
31 namer.getPrimitiveInterceptorRuntimeName(classElement); 31 namer.getPrimitiveInterceptorRuntimeName(classElement);
32 32
33 if (classElement.isMixinApplication) { 33 if (classElement.isMixinApplication) {
34 String mixinName = namer.getNameOfClass(computeMixinClass(classElement)); 34 String mixinName = namer.getNameOfClass(computeMixinClass(classElement));
35 superName = '$superName+$mixinName'; 35 superName = '$superName+$mixinName';
36 task.needsMixinSupport = true; 36 task.needsMixinSupport = true;
37 } 37 }
38 38
39 ClassBuilder builder = new ClassBuilder(); 39 ClassBuilder builder = new ClassBuilder(namer);
40 emitClassConstructor(classElement, builder, runtimeName, 40 emitClassConstructor(classElement, builder, runtimeName,
41 onlyForRti: onlyForRti); 41 onlyForRti: onlyForRti);
42 emitFields(classElement, builder, superName, onlyForRti: onlyForRti); 42 emitFields(classElement, builder, superName, onlyForRti: onlyForRti);
43 emitClassGettersSetters(classElement, builder, onlyForRti: onlyForRti); 43 emitClassGettersSetters(classElement, builder, onlyForRti: onlyForRti);
44 emitInstanceMembers(classElement, builder, onlyForRti: onlyForRti); 44 emitInstanceMembers(classElement, builder, onlyForRti: onlyForRti);
45 task.typeTestEmitter.emitIsTests(classElement, builder); 45 task.typeTestEmitter.emitIsTests(classElement, builder);
46 if (additionalProperties != null) { 46 if (additionalProperties != null) {
47 additionalProperties.forEach(builder.addProperty); 47 additionalProperties.forEach(builder.addProperty);
48 } 48 }
49 49
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 ClassElement superclass = classElement.superclass; 307 ClassElement superclass = classElement.superclass;
308 bool hasSuper = superclass != null; 308 bool hasSuper = superclass != null;
309 if ((!typeVariableProperties.isEmpty && !hasSuper) || 309 if ((!typeVariableProperties.isEmpty && !hasSuper) ||
310 (hasSuper && superclass.typeVariables != typeVars)) { 310 (hasSuper && superclass.typeVariables != typeVars)) {
311 classBuilder.addProperty('<>', 311 classBuilder.addProperty('<>',
312 new jsAst.ArrayInitializer.from(typeVariableProperties)); 312 new jsAst.ArrayInitializer.from(typeVariableProperties));
313 } 313 }
314 } 314 }
315 315
316 List<jsAst.Property> statics = new List<jsAst.Property>(); 316 List<jsAst.Property> statics = new List<jsAst.Property>();
317 ClassBuilder staticsBuilder = new ClassBuilder(); 317 ClassBuilder staticsBuilder = new ClassBuilder(namer);
318 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { 318 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) {
319 statics.add(staticsBuilder.toObjectInitializer().properties.single); 319 statics.add(staticsBuilder.toObjectInitializer().properties.single);
320 } 320 }
321 321
322 Map<OutputUnit, ClassBuilder> classPropertyLists = 322 Map<OutputUnit, ClassBuilder> classPropertyLists =
323 task.elementDescriptors.remove(classElement); 323 task.elementDescriptors.remove(classElement);
324 if (classPropertyLists != null) { 324 if (classPropertyLists != null) {
325 for (ClassBuilder classProperties in classPropertyLists.values) { 325 for (ClassBuilder classProperties in classPropertyLists.values) {
326 // TODO(sigurdm): What about deferred? 326 // TODO(sigurdm): What about deferred?
327 if (classProperties != null) { 327 if (classProperties != null) {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 computeTypeVariable = 594 computeTypeVariable =
595 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 595 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index);
596 } 596 }
597 jsAst.Expression convertRtiToRuntimeType = 597 jsAst.Expression convertRtiToRuntimeType =
598 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); 598 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType'));
599 builder.addProperty( 599 builder.addProperty(
600 name, js.fun( 600 name, js.fun(
601 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); 601 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))]));
602 } 602 }
603 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698