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

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

Issue 10970038: Convert raw strings in compiler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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) 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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 emitMakeConstantList(buffer); 1085 emitMakeConstantList(buffer);
1086 } 1086 }
1087 buffer.add('$isolateProperties.$name = '); 1087 buffer.add('$isolateProperties.$name = ');
1088 writeConstantToBuffer(constant, buffer, emitCanonicalVersion: false); 1088 writeConstantToBuffer(constant, buffer, emitCanonicalVersion: false);
1089 buffer.add(';\n'); 1089 buffer.add(';\n');
1090 } 1090 }
1091 } 1091 }
1092 1092
1093 void emitMakeConstantList(CodeBuffer buffer) { 1093 void emitMakeConstantList(CodeBuffer buffer) {
1094 buffer.add(namer.ISOLATE); 1094 buffer.add(namer.ISOLATE);
1095 buffer.add(@'''.makeConstantList = function(list) { 1095 buffer.add(r'''.makeConstantList = function(list) {
1096 list.immutable$list = true; 1096 list.immutable$list = true;
1097 list.fixed$length = true; 1097 list.fixed$length = true;
1098 return list; 1098 return list;
1099 }; 1099 };
1100 '''); 1100 ''');
1101 } 1101 }
1102 1102
1103 /** 1103 /**
1104 * Documentation wanted -- johnniwinther 1104 * Documentation wanted -- johnniwinther
1105 * 1105 *
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 1355
1356 """); 1356 """);
1357 } 1357 }
1358 1358
1359 String assembleProgram() { 1359 String assembleProgram() {
1360 measure(() { 1360 measure(() {
1361 mainBuffer.add(HOOKS_API_USAGE); 1361 mainBuffer.add(HOOKS_API_USAGE);
1362 mainBuffer.add('function ${namer.ISOLATE}() {}\n'); 1362 mainBuffer.add('function ${namer.ISOLATE}() {}\n');
1363 mainBuffer.add('init();\n\n'); 1363 mainBuffer.add('init();\n\n');
1364 // Shorten the code by using "$$" as temporary. 1364 // Shorten the code by using "$$" as temporary.
1365 classesCollector = @"$$"; 1365 classesCollector = r"$$";
1366 mainBuffer.add('var $classesCollector = {};\n'); 1366 mainBuffer.add('var $classesCollector = {};\n');
1367 // Shorten the code by using [namer.CURRENT_ISOLATE] as temporary. 1367 // Shorten the code by using [namer.CURRENT_ISOLATE] as temporary.
1368 isolateProperties = namer.CURRENT_ISOLATE; 1368 isolateProperties = namer.CURRENT_ISOLATE;
1369 mainBuffer.add('var $isolateProperties = $isolatePropertiesName;\n'); 1369 mainBuffer.add('var $isolateProperties = $isolatePropertiesName;\n');
1370 emitClasses(mainBuffer); 1370 emitClasses(mainBuffer);
1371 mainBuffer.add(boundClosureBuffer); 1371 mainBuffer.add(boundClosureBuffer);
1372 // Clear the buffer, so that we can reuse it for the native classes. 1372 // Clear the buffer, so that we can reuse it for the native classes.
1373 boundClosureBuffer.clear(); 1373 boundClosureBuffer.clear();
1374 emitStaticFunctions(mainBuffer); 1374 emitStaticFunctions(mainBuffer);
1375 emitStaticFunctionGetters(mainBuffer); 1375 emitStaticFunctionGetters(mainBuffer);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 const String HOOKS_API_USAGE = """ 1434 const String HOOKS_API_USAGE = """
1435 // Generated by dart2js, the Dart to JavaScript compiler. 1435 // Generated by dart2js, the Dart to JavaScript compiler.
1436 // The code supports the following hooks: 1436 // The code supports the following hooks:
1437 // dartPrint(message) - if this function is defined it is called 1437 // dartPrint(message) - if this function is defined it is called
1438 // instead of the Dart [print] method. 1438 // instead of the Dart [print] method.
1439 // dartMainRunner(main) - if this function is defined, the Dart [main] 1439 // dartMainRunner(main) - if this function is defined, the Dart [main]
1440 // method will not be invoked directly. 1440 // method will not be invoked directly.
1441 // Instead, a closure that will invoke [main] is 1441 // Instead, a closure that will invoke [main] is
1442 // passed to [dartMainRunner]. 1442 // passed to [dartMainRunner].
1443 """; 1443 """;
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/constant_emitter.dart ('k') | lib/compiler/implementation/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698