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

Side by Side Diff: lib/compiler/implementation/emitter.dart

Issue 10352008: Indentation change for define-class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 buffer = mainBuffer; 336 buffer = mainBuffer;
337 } 337 }
338 338
339 String className = namer.getName(classElement); 339 String className = namer.getName(classElement);
340 ClassElement superclass = classElement.superclass; 340 ClassElement superclass = classElement.superclass;
341 String superName = ""; 341 String superName = "";
342 if (superclass !== null) { 342 if (superclass !== null) {
343 superName = namer.getName(superclass); 343 superName = namer.getName(superclass);
344 } 344 }
345 String constructorName = namer.safeName(classElement.name.slowToString()); 345 String constructorName = namer.safeName(classElement.name.slowToString());
346 buffer.add('$defineClassName("$className", "$superName",\n'); 346 buffer.add('$defineClassName("$className", "$superName", ');
347 buffer.add('function $constructorName('); 347 buffer.add('function $constructorName(');
348 StringBuffer bodyBuffer = new StringBuffer(); 348 StringBuffer bodyBuffer = new StringBuffer();
349 // If the class is never instantiated we still need to set it up for 349 // If the class is never instantiated we still need to set it up for
350 // inheritance purposes, but we can leave its JavaScript constructor empty. 350 // inheritance purposes, but we can leave its JavaScript constructor empty.
351 if (compiler.universe.instantiatedClasses.contains(classElement)) { 351 if (compiler.universe.instantiatedClasses.contains(classElement)) {
352 generateFieldInits(classElement, buffer, bodyBuffer); 352 generateFieldInits(classElement, buffer, bodyBuffer);
353 } 353 }
354 buffer.add(') {\n'); 354 buffer.add(') {\n');
355 buffer.add(bodyBuffer); 355 buffer.add(bodyBuffer);
356 buffer.add('}, '); 356 buffer.add(' }, ');
357 357
358 buffer.add('{\n'); 358 buffer.add('{\n');
359 359
360 void defineInstanceMember(String name, String value) { 360 void defineInstanceMember(String name, String value) {
361 buffer.add(' $name: $value,\n'); 361 buffer.add(' $name: $value,\n');
362 } 362 }
363 363
364 classElement.forEachMember(includeBackendMembers: true, 364 classElement.forEachMember(includeBackendMembers: true,
365 f: (ClassElement enclosing, Element member) { 365 f: (ClassElement enclosing, Element member) {
366 if (member.isInstanceMember()) { 366 if (member.isInstanceMember()) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 emitFinishClassesInvocationIfNecessary(mainBuffer); 835 emitFinishClassesInvocationIfNecessary(mainBuffer);
836 emitMain(mainBuffer); 836 emitMain(mainBuffer);
837 mainBuffer.add('function init() {\n'); 837 mainBuffer.add('function init() {\n');
838 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); 838 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer);
839 mainBuffer.add('}\n'); 839 mainBuffer.add('}\n');
840 compiler.assembledCode = mainBuffer.toString(); 840 compiler.assembledCode = mainBuffer.toString();
841 }); 841 });
842 return compiler.assembledCode; 842 return compiler.assembledCode;
843 } 843 }
844 } 844 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698