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

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

Issue 1171713002: remove ClosureWrap option and related implementation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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/info.dart ('k') | lib/src/testing.dart » ('j') | 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) 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 /// Set of flags and options passed to the compiler 5 /// Set of flags and options passed to the compiler
6 library dev_compiler.src.options; 6 library dev_compiler.src.options;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:args/args.dart'; 10 import 'package:args/args.dart';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 /// Whether to infer types downwards from local context 79 /// Whether to infer types downwards from local context
80 final bool inferDownwards; 80 final bool inferDownwards;
81 static const inferDownwardsDefault = true; 81 static const inferDownwardsDefault = true;
82 82
83 /// Whether to inject casts between Dart assignable types. 83 /// Whether to inject casts between Dart assignable types.
84 final bool relaxedCasts; 84 final bool relaxedCasts;
85 85
86 /// Whether to use static types for code generation. 86 /// Whether to use static types for code generation.
87 final bool ignoreTypes; 87 final bool ignoreTypes;
88 88
89 /// Whether to wrap closures for compatibility.
90 final bool wrapClosures;
91 static const wrapClosuresDefault = false;
92
93 RulesOptions({this.covariantGenerics: true, 89 RulesOptions({this.covariantGenerics: true,
94 this.inferDownwards: inferDownwardsDefault, this.relaxedCasts: true, 90 this.inferDownwards: inferDownwardsDefault, this.relaxedCasts: true,
95 this.ignoreTypes: false, this.wrapClosures: wrapClosuresDefault}); 91 this.ignoreTypes: false});
96 } 92 }
97 93
98 class JSCodeOptions { 94 class JSCodeOptions {
99 /// Whether to emit the source map files. 95 /// Whether to emit the source map files.
100 final bool emitSourceMaps; 96 final bool emitSourceMaps;
101 97
102 JSCodeOptions({this.emitSourceMaps: true}); 98 JSCodeOptions({this.emitSourceMaps: true});
103 } 99 }
104 100
105 /// General options used by the dev compiler. 101 /// General options used by the dev compiler.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 final bool onlyInferConstsAndFinalFields; 193 final bool onlyInferConstsAndFinalFields;
198 194
199 /// List of non-nullable types. 195 /// List of non-nullable types.
200 @override 196 @override
201 final List<String> nonnullableTypes; 197 final List<String> nonnullableTypes;
202 198
203 /// Whether to use static types for code generation. 199 /// Whether to use static types for code generation.
204 @override 200 @override
205 final bool ignoreTypes; 201 final bool ignoreTypes;
206 202
207 /// Whether to wrap closures for compatibility.
208 @override
209 final bool wrapClosures;
210
211 /// Whether to emit the source map files. 203 /// Whether to emit the source map files.
212 @override 204 @override
213 final bool emitSourceMaps; 205 final bool emitSourceMaps;
214 206
215 /// Location for runtime files, such as `dart_runtime.js`. By default this is 207 /// Location for runtime files, such as `dart_runtime.js`. By default this is
216 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` 208 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler`
217 /// package (if we can infer where that is located). 209 /// package (if we can infer where that is located).
218 final String runtimeDir; 210 final String runtimeDir;
219 211
220 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart" 212 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart"
221 final Map<String, String> customUrlMappings; 213 final Map<String, String> customUrlMappings;
222 214
223 CompilerOptions({this.checkSdk: false, this.dumpInfo: false, 215 CompilerOptions({this.checkSdk: false, this.dumpInfo: false,
224 this.dumpInfoFile, this.forceCompile: false, this.ignoreTypes: false, 216 this.dumpInfoFile, this.forceCompile: false, this.ignoreTypes: false,
225 this.wrapClosures: RulesOptions.wrapClosuresDefault, this.outputDir, 217 this.outputDir, this.useColors: true, this.covariantGenerics: true,
226 this.useColors: true, this.covariantGenerics: true,
227 this.relaxedCasts: true, this.useMultiPackage: false, 218 this.relaxedCasts: true, this.useMultiPackage: false,
228 this.packageRoot: 'packages/', this.packagePaths: const <String>[], 219 this.packageRoot: 'packages/', this.packagePaths: const <String>[],
229 this.resources: const <String>[], 220 this.resources: const <String>[],
230 this.inferDownwards: RulesOptions.inferDownwardsDefault, 221 this.inferDownwards: RulesOptions.inferDownwardsDefault,
231 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, 222 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault,
232 this.inferTransitively: ResolverOptions.inferTransitivelyDefault, 223 this.inferTransitively: ResolverOptions.inferTransitivelyDefault,
233 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault, 224 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault,
234 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, 225 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false,
235 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, 226 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE,
236 this.emitSourceMaps: true, this.entryPointFile: null, 227 this.emitSourceMaps: true, this.entryPointFile: null,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 275 }
285 276
286 var entryPointFile = args.rest.length == 0 ? null : args.rest.first; 277 var entryPointFile = args.rest.length == 0 ? null : args.rest.first;
287 278
288 return new CompilerOptions( 279 return new CompilerOptions(
289 checkSdk: args['sdk-check'], 280 checkSdk: args['sdk-check'],
290 dumpInfo: dumpInfo, 281 dumpInfo: dumpInfo,
291 dumpInfoFile: args['dump-info-file'], 282 dumpInfoFile: args['dump-info-file'],
292 forceCompile: args['force-compile'] || serverMode, 283 forceCompile: args['force-compile'] || serverMode,
293 ignoreTypes: args['ignore-types'], 284 ignoreTypes: args['ignore-types'],
294 wrapClosures: args['wrap-closures'],
295 outputDir: outputDir, 285 outputDir: outputDir,
296 covariantGenerics: args['covariant-generics'], 286 covariantGenerics: args['covariant-generics'],
297 relaxedCasts: args['relaxed-casts'], 287 relaxedCasts: args['relaxed-casts'],
298 useColors: useColors, 288 useColors: useColors,
299 customUrlMappings: customUrlMappings, 289 customUrlMappings: customUrlMappings,
300 useMultiPackage: args['use-multi-package'], 290 useMultiPackage: args['use-multi-package'],
301 packageRoot: args['package-root'], 291 packageRoot: args['package-root'],
302 packagePaths: args['package-paths'].split(','), 292 packagePaths: args['package-paths'].split(','),
303 resources: args['resources'] 293 resources: args['resources']
304 .split(',') 294 .split(',')
(...skipping 22 matching lines...) Expand all
327 final ArgParser argParser = new ArgParser() 317 final ArgParser argParser = new ArgParser()
328 // resolver/checker options 318 // resolver/checker options
329 ..addFlag('sdk-check', 319 ..addFlag('sdk-check',
330 abbr: 's', help: 'Typecheck sdk libs', defaultsTo: false) 320 abbr: 's', help: 'Typecheck sdk libs', defaultsTo: false)
331 ..addFlag('mock-sdk', 321 ..addFlag('mock-sdk',
332 abbr: 'm', help: 'Use a mock Dart SDK', defaultsTo: false) 322 abbr: 'm', help: 'Use a mock Dart SDK', defaultsTo: false)
333 ..addFlag('covariant-generics', 323 ..addFlag('covariant-generics',
334 help: 'Use covariant generics', defaultsTo: true) 324 help: 'Use covariant generics', defaultsTo: true)
335 ..addFlag('ignore-types', 325 ..addFlag('ignore-types',
336 help: 'Ignore types during codegen', defaultsTo: false) 326 help: 'Ignore types during codegen', defaultsTo: false)
337 ..addFlag('wrap-closures',
338 help: 'wrap closures implicitly',
339 defaultsTo: RulesOptions.wrapClosuresDefault)
340 ..addFlag('relaxed-casts', 327 ..addFlag('relaxed-casts',
341 help: 'Cast between Dart assignable types', defaultsTo: true) 328 help: 'Cast between Dart assignable types', defaultsTo: true)
342 ..addOption('nonnullable', 329 ..addOption('nonnullable',
343 abbr: 'n', 330 abbr: 'n',
344 help: 'Comma separated string of non-nullable types', 331 help: 'Comma separated string of non-nullable types',
345 defaultsTo: null) 332 defaultsTo: null)
346 ..addFlag('infer-downwards', 333 ..addFlag('infer-downwards',
347 help: 'Infer types downwards from local context', 334 help: 'Infer types downwards from local context',
348 defaultsTo: RulesOptions.inferDownwardsDefault) 335 defaultsTo: RulesOptions.inferDownwardsDefault)
349 ..addFlag('infer-from-overrides', 336 ..addFlag('infer-from-overrides',
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // The pub-cache directory is two levels up, but we verify that the layout 435 // The pub-cache directory is two levels up, but we verify that the layout
449 // looks correct. 436 // looks correct.
450 if (path.basename(dir) != 'dev_compiler') return null; 437 if (path.basename(dir) != 'dev_compiler') return null;
451 dir = path.dirname(dir); 438 dir = path.dirname(dir);
452 if (path.basename(dir) != 'global_packages') return null; 439 if (path.basename(dir) != 'global_packages') return null;
453 dir = path.dirname(dir); 440 dir = path.dirname(dir);
454 return path.join(dir, cacheDir, 'lib', 'runtime'); 441 return path.join(dir, cacheDir, 'lib', 'runtime');
455 } 442 }
456 return null; 443 return null;
457 } 444 }
OLDNEW
« no previous file with comments | « lib/src/info.dart ('k') | lib/src/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698