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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart

Issue 1548793002: dart2js: format 'static' sections better. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/printer.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) 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.full_emitter; 5 part of dart2js.js_emitter.full_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 8
9 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 322
323 // TODO(herhut): Do not grab statics out of the properties. 323 // TODO(herhut): Do not grab statics out of the properties.
324 ClassBuilder classProperties = 324 ClassBuilder classProperties =
325 emitter.elementDescriptors[fragment].remove(classElement); 325 emitter.elementDescriptors[fragment].remove(classElement);
326 if (classProperties != null) { 326 if (classProperties != null) {
327 statics.addAll(classProperties.properties); 327 statics.addAll(classProperties.properties);
328 } 328 }
329 329
330 if (!statics.isEmpty) { 330 if (!statics.isEmpty) {
331 classBuilder.addPropertyByName('static', 331 classBuilder.addPropertyByName(
332 new jsAst.ObjectInitializer(statics)); 332 'static',
333 new jsAst.ObjectInitializer(statics, isOneLiner: false));
333 } 334 }
334 335
335 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. 336 // TODO(ahe): This method (generateClass) should return a jsAst.Expression.
336 jsAst.ObjectInitializer propertyValue = 337 jsAst.ObjectInitializer propertyValue =
337 classBuilder.toObjectInitializer(); 338 classBuilder.toObjectInitializer();
338 compiler.dumpInfoTask.registerElementAst(classBuilder.element, propertyValue ); 339 compiler.dumpInfoTask.registerElementAst(classBuilder.element, propertyValue );
339 enclosingBuilder.addProperty(className, propertyValue); 340 enclosingBuilder.addProperty(className, propertyValue);
340 341
341 String reflectionName = emitter.getReflectionName(classElement, className); 342 String reflectionName = emitter.getReflectionName(classElement, className);
342 if (reflectionName != null) { 343 if (reflectionName != null) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 : new Selector.setter( 427 : new Selector.setter(
427 new Name(member.name, member.library, isSetter: true)); 428 new Name(member.name, member.library, isSetter: true));
428 String reflectionName = emitter.getReflectionName(selector, name); 429 String reflectionName = emitter.getReflectionName(selector, name);
429 if (reflectionName != null) { 430 if (reflectionName != null) {
430 var reflectable = 431 var reflectable =
431 js(backend.isAccessibleByReflection(member) ? '1' : '0'); 432 js(backend.isAccessibleByReflection(member) ? '1' : '0');
432 builder.addPropertyByName('+$reflectionName', reflectable); 433 builder.addPropertyByName('+$reflectionName', reflectable);
433 } 434 }
434 } 435 }
435 } 436 }
OLDNEW
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698