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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart

Issue 824103005: Revert "Remove Compiler.assembledCode." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.new_js_emitter.model_emitter; 5 library dart2js.new_js_emitter.model_emitter;
6 6
7 import '../../dart2jslib.dart' show Compiler; 7 import '../../dart2jslib.dart' show Compiler;
8 import '../../js/js.dart' as js; 8 import '../../js/js.dart' as js;
9 import '../../js_backend/js_backend.dart' show 9 import '../../js_backend/js_backend.dart' show
10 JavaScriptBackend, 10 JavaScriptBackend,
(...skipping 20 matching lines...) Expand all
31 r"$__dart_deferred_initializers__"; 31 r"$__dart_deferred_initializers__";
32 32
33 static const String deferredExtension = "part.js"; 33 static const String deferredExtension = "part.js";
34 34
35 ModelEmitter(Compiler compiler, Namer namer) 35 ModelEmitter(Compiler compiler, Namer namer)
36 : this.compiler = compiler, 36 : this.compiler = compiler,
37 this.namer = namer, 37 this.namer = namer,
38 constantEmitter = 38 constantEmitter =
39 new ConstantEmitter(compiler, namer, makeConstantListTemplate); 39 new ConstantEmitter(compiler, namer, makeConstantListTemplate);
40 40
41 int emitProgram(Program program) { 41 void emitProgram(Program program) {
42 List<Output> outputs = program.outputs; 42 List<Output> outputs = program.outputs;
43 MainOutput mainUnit = outputs.first; 43 MainOutput mainUnit = outputs.first;
44 js.Statement mainAst = emitMainUnit(program); 44 js.Statement mainAst = emitMainUnit(program);
45 String mainCode = js.prettyPrint(mainAst, compiler).getText(); 45 String mainCode = js.prettyPrint(mainAst, compiler).getText();
46 compiler.outputProvider(mainUnit.outputFileName, 'js') 46 compiler.outputProvider(mainUnit.outputFileName, 'js')
47 ..add(buildGeneratedBy(compiler)) 47 ..add(buildGeneratedBy(compiler))
48 ..add(mainCode) 48 ..add(mainCode)
49 ..close(); 49 ..close();
50 int totalSize = mainCode.length; 50 compiler.assembledCode = mainCode;
51 51
52 outputs.skip(1).forEach((DeferredOutput deferredUnit) { 52 outputs.skip(1).forEach((DeferredOutput deferredUnit) {
53 js.Expression ast = emitDeferredUnit(deferredUnit, mainUnit.holders); 53 js.Expression ast = emitDeferredUnit(deferredUnit, mainUnit.holders);
54 String code = js.prettyPrint(ast, compiler).getText(); 54 String code = js.prettyPrint(ast, compiler).getText();
55 totalSize += code.length;
56 compiler.outputProvider(deferredUnit.outputFileName, deferredExtension) 55 compiler.outputProvider(deferredUnit.outputFileName, deferredExtension)
57 ..add(code) 56 ..add(code)
58 ..close(); 57 ..close();
59 }); 58 });
60 return totalSize;
61 } 59 }
62 60
63 js.LiteralString unparse(Compiler compiler, js.Expression value) { 61 js.LiteralString unparse(Compiler compiler, js.Expression value) {
64 String text = js.prettyPrint(value, compiler).getText(); 62 String text = js.prettyPrint(value, compiler).getText();
65 if (value is js.Fun) text = '($text)'; 63 if (value is js.Fun) text = '($text)';
66 return js.js.escapedString(text); 64 return js.js.escapedString(text);
67 } 65 }
68 66
69 String buildGeneratedBy(compiler) { 67 String buildGeneratedBy(compiler) {
70 var suffix = ''; 68 var suffix = '';
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 544
547 var end = Date.now(); 545 var end = Date.now();
548 print('Setup: ' + (end - start) + ' ms.'); 546 print('Setup: ' + (end - start) + ' ms.');
549 547
550 #main(); // Start main. 548 #main(); // Start main.
551 549
552 }(Date.now(), #code) 550 }(Date.now(), #code)
553 }"""; 551 }""";
554 552
555 } 553 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698