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

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

Issue 11828043: Extend compiler API to support multiple outputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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) 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 mainBuffer.add('$isolateProperties$_=$_{}$N'); 2158 mainBuffer.add('$isolateProperties$_=$_{}$N');
2159 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); 2159 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer);
2160 addLazyInitializerFunctionIfNecessary(mainBuffer); 2160 addLazyInitializerFunctionIfNecessary(mainBuffer);
2161 emitFinishIsolateConstructor(mainBuffer); 2161 emitFinishIsolateConstructor(mainBuffer);
2162 mainBuffer.add('}\n'); 2162 mainBuffer.add('}\n');
2163 compiler.assembledCode = mainBuffer.getText(); 2163 compiler.assembledCode = mainBuffer.getText();
2164 2164
2165 if (generateSourceMap) { 2165 if (generateSourceMap) {
2166 SourceFile compiledFile = new SourceFile(null, compiler.assembledCode); 2166 SourceFile compiledFile = new SourceFile(null, compiler.assembledCode);
2167 String sourceMap = buildSourceMap(mainBuffer, compiledFile); 2167 String sourceMap = buildSourceMap(mainBuffer, compiledFile);
2168 // TODO(podivilov): We should find a better way to return source maps to 2168 compiler.outputProvider('', 'js.map')
2169 // compiler. Using diagnostic handler for that purpose is a temporary 2169 ..add(sourceMap)
2170 // hack. 2170 ..close();
ngeoffray 2013/01/10 12:15:21 Would that look nicer if it was just below the '.'
ahe 2013/01/25 15:50:09 It might look nicer, but it I think it would be co
2171 compiler.reportDiagnostic(
2172 null, sourceMap, new api.Diagnostic(-1, 'source map'));
2173 } 2171 }
2174 }); 2172 });
2175 return compiler.assembledCode; 2173 return compiler.assembledCode;
2176 } 2174 }
2177 2175
2178 String buildSourceMap(CodeBuffer buffer, SourceFile compiledFile) { 2176 String buildSourceMap(CodeBuffer buffer, SourceFile compiledFile) {
2179 SourceMapBuilder sourceMapBuilder = new SourceMapBuilder(); 2177 SourceMapBuilder sourceMapBuilder = new SourceMapBuilder();
2180 buffer.forEachSourceLocation(sourceMapBuilder.addMapping); 2178 buffer.forEachSourceLocation(sourceMapBuilder.addMapping);
2181 return sourceMapBuilder.build(compiledFile); 2179 return sourceMapBuilder.build(compiledFile);
2182 } 2180 }
2183 } 2181 }
2184 2182
2185 const String GENERATED_BY = """ 2183 const String GENERATED_BY = """
2186 // Generated by dart2js, the Dart to JavaScript compiler. 2184 // Generated by dart2js, the Dart to JavaScript compiler.
2187 """; 2185 """;
2188 const String HOOKS_API_USAGE = """ 2186 const String HOOKS_API_USAGE = """
2189 // The code supports the following hooks: 2187 // The code supports the following hooks:
2190 // dartPrint(message) - if this function is defined it is called 2188 // dartPrint(message) - if this function is defined it is called
2191 // instead of the Dart [print] method. 2189 // instead of the Dart [print] method.
2192 // dartMainRunner(main) - if this function is defined, the Dart [main] 2190 // dartMainRunner(main) - if this function is defined, the Dart [main]
2193 // method will not be invoked directly. 2191 // method will not be invoked directly.
2194 // Instead, a closure that will invoke [main] is 2192 // Instead, a closure that will invoke [main] is
2195 // passed to [dartMainRunner]. 2193 // passed to [dartMainRunner].
2196 """; 2194 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698