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

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

Issue 1986693003: Provide option to suppress mirrors metadata (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
« no previous file with comments | « lib/src/compiler/code_generator.dart ('k') | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:collection' show HashSet; 5 import 'dart:collection' show HashSet;
6 import 'package:args/args.dart' show ArgParser, ArgResults; 6 import 'package:args/args.dart' show ArgParser, ArgResults;
7 import 'package:analyzer/analyzer.dart' 7 import 'package:analyzer/analyzer.dart'
8 show 8 show
9 AnalysisError, 9 AnalysisError,
10 CompilationUnit, 10 CompilationUnit,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 /// If [sourceMap] is emitted, this will emit a `sourceMappingUrl` comment 144 /// If [sourceMap] is emitted, this will emit a `sourceMappingUrl` comment
145 /// into the output JavaScript module. 145 /// into the output JavaScript module.
146 final bool sourceMapComment; 146 final bool sourceMapComment;
147 147
148 /// Whether to emit a summary file containing API signatures. 148 /// Whether to emit a summary file containing API signatures.
149 /// 149 ///
150 /// This is required for a modular build process. 150 /// This is required for a modular build process.
151 final bool summarizeApi; 151 final bool summarizeApi;
152 152
153 /// Whether to preserve metdata only accessible via mirrors
154 final bool preserveAnnotations;
155
153 /// Whether to force compilation of code with static errors. 156 /// Whether to force compilation of code with static errors.
154 final bool unsafeForceCompile; 157 final bool unsafeForceCompile;
155 158
156 /// Whether to emit Closure Compiler-friendly code. 159 /// Whether to emit Closure Compiler-friendly code.
157 final bool closure; 160 final bool closure;
158 161
159 /// Enable ES6 destructuring of named parameters. Off by default. 162 /// Enable ES6 destructuring of named parameters. Off by default.
160 /// 163 ///
161 /// Older V8 versions do not accept default values with destructuring in 164 /// Older V8 versions do not accept default values with destructuring in
162 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them 165 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them
(...skipping 11 matching lines...) Expand all
174 177
175 /// Which module format to support. 178 /// Which module format to support.
176 /// Currently 'es6' and 'legacy' are supported. 179 /// Currently 'es6' and 'legacy' are supported.
177 final ModuleFormat moduleFormat; 180 final ModuleFormat moduleFormat;
178 181
179 const CompilerOptions( 182 const CompilerOptions(
180 {this.sourceMap: true, 183 {this.sourceMap: true,
181 this.sourceMapComment: true, 184 this.sourceMapComment: true,
182 this.summarizeApi: true, 185 this.summarizeApi: true,
183 this.unsafeForceCompile: false, 186 this.unsafeForceCompile: false,
187 this.preserveAnnotations: false,
184 this.closure: false, 188 this.closure: false,
185 this.destructureNamedParams: false, 189 this.destructureNamedParams: false,
186 this.moduleFormat: ModuleFormat.legacy}); 190 this.moduleFormat: ModuleFormat.legacy});
187 191
188 CompilerOptions.fromArguments(ArgResults args) 192 CompilerOptions.fromArguments(ArgResults args)
189 : sourceMap = args['source-map'], 193 : sourceMap = args['source-map'],
190 sourceMapComment = args['source-map-comment'], 194 sourceMapComment = args['source-map-comment'],
191 summarizeApi = args['summarize'], 195 summarizeApi = args['summarize'],
192 unsafeForceCompile = args['unsafe-force-compile'], 196 unsafeForceCompile = args['unsafe-force-compile'],
197 preserveAnnotations = args['preserve-annotations'],
193 closure = args['closure-experimental'], 198 closure = args['closure-experimental'],
194 destructureNamedParams = args['destructure-named-params'], 199 destructureNamedParams = args['destructure-named-params'],
195 moduleFormat = parseModuleFormat(args['modules']); 200 moduleFormat = parseModuleFormat(args['modules']);
196 201
197 static ArgParser addArguments(ArgParser parser) => parser 202 static ArgParser addArguments(ArgParser parser) => parser
198 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) 203 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true)
199 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) 204 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true)
200 ..addFlag('source-map-comment', 205 ..addFlag('source-map-comment',
201 help: 'adds a sourceMappingURL comment to the end of the JS,\n' 206 help: 'adds a sourceMappingURL comment to the end of the JS,\n'
202 'disable if using X-SourceMap header', 207 'disable if using X-SourceMap header',
203 defaultsTo: true) 208 defaultsTo: true)
204 ..addOption('modules', 209 ..addOption('modules',
205 help: 'module pattern to emit', 210 help: 'module pattern to emit',
206 allowed: ['es6', 'legacy', 'node'], 211 allowed: ['es6', 'legacy', 'node'],
207 allowedHelp: { 212 allowedHelp: {
208 'es6': 'es6 modules', 213 'es6': 'es6 modules',
209 'legacy': 'a custom format used by dartdevc, similar to AMD', 214 'legacy': 'a custom format used by dartdevc, similar to AMD',
210 'node': 'node.js modules (https://nodejs.org/api/modules.html)' 215 'node': 'node.js modules (https://nodejs.org/api/modules.html)'
211 }, 216 },
212 defaultsTo: 'legacy') 217 defaultsTo: 'legacy')
218 ..addFlag('preserve-annotations',
Jennifer Messerly 2016/05/17 21:39:42 maybe "emit-metadata" -- slightly shorter? we als
219 help: 'emit metadata annotations queriable via mirrors',
220 defaultsTo: false)
213 ..addFlag('closure-experimental', 221 ..addFlag('closure-experimental',
214 help: 'emit Closure Compiler-friendly code (experimental)', 222 help: 'emit Closure Compiler-friendly code (experimental)',
215 defaultsTo: false) 223 defaultsTo: false)
216 ..addFlag('destructure-named-params', 224 ..addFlag('destructure-named-params',
217 help: 'Destructure named parameters', defaultsTo: false) 225 help: 'Destructure named parameters', defaultsTo: false)
218 ..addFlag('unsafe-force-compile', 226 ..addFlag('unsafe-force-compile',
219 help: 'Compile code even if it has errors. ಠ_ಠ\n' 227 help: 'Compile code even if it has errors. ಠ_ಠ\n'
220 'This has undefined behavior!', 228 'This has undefined behavior!',
221 defaultsTo: false); 229 defaultsTo: false);
222 } 230 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 308 }
301 } 309 }
302 310
303 /// (Public for tests) the error code used when a part is missing. 311 /// (Public for tests) the error code used when a part is missing.
304 final missingPartErrorCode = const CompileTimeErrorCode( 312 final missingPartErrorCode = const CompileTimeErrorCode(
305 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); 313 'MISSING_PART', 'The part was not supplied as an input to the compiler.');
306 314
307 /// (Public for tests) the error code used when a part is unused. 315 /// (Public for tests) the error code used when a part is unused.
308 final unusedPartWarningCode = const StaticWarningCode( 316 final unusedPartWarningCode = const StaticWarningCode(
309 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); 317 'UNUSED_PART', 'The part was not used by any libraries being compiled.');
OLDNEW
« no previous file with comments | « lib/src/compiler/code_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698