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

Side by Side Diff: pkg/compiler/lib/src/js/js.dart

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 js; 5 library js;
6 6
7 import 'package:js_ast/js_ast.dart'; 7 import 'package:js_ast/js_ast.dart';
8 export 'package:js_ast/js_ast.dart'; 8 export 'package:js_ast/js_ast.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
11 import '../compiler.dart' show 11 import '../compiler.dart' show
12 Compiler; 12 Compiler;
13 import '../dump_info.dart' show 13 import '../dump_info.dart' show
14 DumpInfoTask; 14 DumpInfoTask;
15 import '../io/code_output.dart' show 15 import '../io/code_output.dart' show
16 CodeBuffer, 16 CodeBuffer,
17 CodeOutput; 17 CodeOutput;
18 import '../js_emitter/js_emitter.dart' show 18 import '../js_emitter/js_emitter.dart' show
19 USE_LAZY_EMITTER; 19 USE_LAZY_EMITTER;
20 20
21 import 'js_source_mapping.dart'; 21 import 'js_source_mapping.dart';
22 22
23 String prettyPrint( 23 String prettyPrint(
24 Node node, 24 Node node,
25 Compiler compiler, 25 Compiler compiler,
26 {bool allowVariableMinification: true, 26 {bool allowVariableMinification: true,
27 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) { 27 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) {
28 // TODO(johnniwinther): Do we need all the options here? 28 // TODO(johnniwinther): Do we need all the options here?
29 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( 29 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions(
30 shouldCompressOutput: compiler.enableMinification, 30 shouldCompressOutput: compiler.options.enableMinification,
31 minifyLocalVariables: allowVariableMinification, 31 minifyLocalVariables: allowVariableMinification,
32 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER, 32 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER,
33 renamerForNames: renamerForNames); 33 renamerForNames: renamerForNames);
34 SimpleJavaScriptPrintingContext context = 34 SimpleJavaScriptPrintingContext context =
35 new SimpleJavaScriptPrintingContext(); 35 new SimpleJavaScriptPrintingContext();
36 Printer printer = new Printer(options, context); 36 Printer printer = new Printer(options, context);
37 printer.visit(node); 37 printer.visit(node);
38 return context.getText(); 38 return context.getText();
39 } 39 }
40 40
41 CodeBuffer createCodeBuffer( 41 CodeBuffer createCodeBuffer(
42 Node node, 42 Node node,
43 Compiler compiler, 43 Compiler compiler,
44 {DumpInfoTask monitor, 44 {DumpInfoTask monitor,
45 bool allowVariableMinification: true, 45 bool allowVariableMinification: true,
46 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) { 46 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) {
47 JavaScriptSourceInformationStrategy sourceInformationFactory = 47 JavaScriptSourceInformationStrategy sourceInformationFactory =
48 compiler.backend.sourceInformationStrategy; 48 compiler.backend.sourceInformationStrategy;
49 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( 49 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions(
50 shouldCompressOutput: compiler.enableMinification, 50 shouldCompressOutput: compiler.options.enableMinification,
51 minifyLocalVariables: allowVariableMinification, 51 minifyLocalVariables: allowVariableMinification,
52 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER, 52 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER,
53 renamerForNames: renamerForNames); 53 renamerForNames: renamerForNames);
54 CodeBuffer outBuffer = new CodeBuffer(); 54 CodeBuffer outBuffer = new CodeBuffer();
55 SourceInformationProcessor sourceInformationProcessor = 55 SourceInformationProcessor sourceInformationProcessor =
56 sourceInformationFactory.createProcessor( 56 sourceInformationFactory.createProcessor(
57 new SourceLocationsMapper(outBuffer)); 57 new SourceLocationsMapper(outBuffer));
58 Dart2JSJavaScriptPrintingContext context = 58 Dart2JSJavaScriptPrintingContext context =
59 new Dart2JSJavaScriptPrintingContext( 59 new Dart2JSJavaScriptPrintingContext(
60 compiler.reporter, monitor, outBuffer, sourceInformationProcessor); 60 compiler.reporter, monitor, outBuffer, sourceInformationProcessor);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 if (node is PropertyAccess) { 204 if (node is PropertyAccess) {
205 PropertyAccess access = node; 205 PropertyAccess access = node;
206 if (access.receiver is InterpolatedExpression) { 206 if (access.receiver is InterpolatedExpression) {
207 InterpolatedExpression hole = access.receiver; 207 InterpolatedExpression hole = access.receiver;
208 return hole.isPositional && hole.nameOrPosition == 0; 208 return hole.isPositional && hole.nameOrPosition == 0;
209 } 209 }
210 } 210 }
211 return false; 211 return false;
212 } 212 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698