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

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

Issue 1165303002: remove covariant generics option (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/checker/rules.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 this.packagePaths: const <String>[], this.resources: const <String>[], 66 this.packagePaths: const <String>[], this.resources: const <String>[],
67 this.inferFromOverrides: inferFromOverridesDefault, 67 this.inferFromOverrides: inferFromOverridesDefault,
68 this.inferTransitively: inferTransitivelyDefault, 68 this.inferTransitively: inferTransitivelyDefault,
69 this.onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault, 69 this.onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault,
70 this.entryPointFile: null, this.useImplicitHtml: false}); 70 this.entryPointFile: null, this.useImplicitHtml: false});
71 } 71 }
72 72
73 // TODO(vsm): Merge RulesOptions and TypeOptions 73 // TODO(vsm): Merge RulesOptions and TypeOptions
74 /// Options used by our RestrictedRules. 74 /// Options used by our RestrictedRules.
75 class RulesOptions extends TypeOptions { 75 class RulesOptions extends TypeOptions {
76 /// Whether to use covariant generics
77 final bool covariantGenerics;
78
79 /// Whether to infer types downwards from local context 76 /// Whether to infer types downwards from local context
80 final bool inferDownwards; 77 final bool inferDownwards;
81 static const inferDownwardsDefault = true; 78 static const inferDownwardsDefault = true;
82 79
83 /// Whether to inject casts between Dart assignable types. 80 /// Whether to inject casts between Dart assignable types.
84 final bool relaxedCasts; 81 final bool relaxedCasts;
85 82
86 /// Whether to use static types for code generation. 83 /// Whether to use static types for code generation.
87 final bool ignoreTypes; 84 final bool ignoreTypes;
88 85
89 RulesOptions({this.covariantGenerics: true, 86 RulesOptions({this.inferDownwards: inferDownwardsDefault,
90 this.inferDownwards: inferDownwardsDefault, this.relaxedCasts: true, 87 this.relaxedCasts: true, this.ignoreTypes: false});
91 this.ignoreTypes: false});
92 } 88 }
93 89
94 class JSCodeOptions { 90 class JSCodeOptions {
95 /// Whether to emit the source map files. 91 /// Whether to emit the source map files.
96 final bool emitSourceMaps; 92 final bool emitSourceMaps;
97 93
98 JSCodeOptions({this.emitSourceMaps: true}); 94 JSCodeOptions({this.emitSourceMaps: true});
99 } 95 }
100 96
101 /// General options used by the dev compiler. 97 /// General options used by the dev compiler.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 139
144 /// Whether to enable hash-based caching of files. 140 /// Whether to enable hash-based caching of files.
145 final bool enableHashing; 141 final bool enableHashing;
146 142
147 /// Port used for the HTTP server when [serverMode] is on. 143 /// Port used for the HTTP server when [serverMode] is on.
148 final int port; 144 final int port;
149 145
150 /// Host name or address for HTTP server when [serverMode] is on. 146 /// Host name or address for HTTP server when [serverMode] is on.
151 final String host; 147 final String host;
152 148
153 /// Whether to use covariant generics
154 @override
155 final bool covariantGenerics;
156
157 /// Whether to inject casts between Dart assignable types. 149 /// Whether to inject casts between Dart assignable types.
158 @override 150 @override
159 final bool relaxedCasts; 151 final bool relaxedCasts;
160 152
161 /// Whether to resolve 'package:' uris using the multi-package resolver. 153 /// Whether to resolve 'package:' uris using the multi-package resolver.
162 @override 154 @override
163 final bool useMultiPackage; 155 final bool useMultiPackage;
164 156
165 /// Package root when resolving 'package:' urls the standard way. 157 /// Package root when resolving 'package:' urls the standard way.
166 @override 158 @override
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 /// Location for runtime files, such as `dart_runtime.js`. By default this is 199 /// Location for runtime files, such as `dart_runtime.js`. By default this is
208 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` 200 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler`
209 /// package (if we can infer where that is located). 201 /// package (if we can infer where that is located).
210 final String runtimeDir; 202 final String runtimeDir;
211 203
212 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart" 204 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart"
213 final Map<String, String> customUrlMappings; 205 final Map<String, String> customUrlMappings;
214 206
215 CompilerOptions({this.checkSdk: false, this.dumpInfo: false, 207 CompilerOptions({this.checkSdk: false, this.dumpInfo: false,
216 this.dumpInfoFile, this.forceCompile: false, this.ignoreTypes: false, 208 this.dumpInfoFile, this.forceCompile: false, this.ignoreTypes: false,
217 this.outputDir, this.useColors: true, this.covariantGenerics: true, 209 this.outputDir, this.useColors: true, this.relaxedCasts: true,
218 this.relaxedCasts: true, this.useMultiPackage: false, 210 this.useMultiPackage: false, this.packageRoot: 'packages/',
219 this.packageRoot: 'packages/', this.packagePaths: const <String>[], 211 this.packagePaths: const <String>[], this.resources: const <String>[],
220 this.resources: const <String>[],
221 this.inferDownwards: RulesOptions.inferDownwardsDefault, 212 this.inferDownwards: RulesOptions.inferDownwardsDefault,
222 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, 213 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault,
223 this.inferTransitively: ResolverOptions.inferTransitivelyDefault, 214 this.inferTransitively: ResolverOptions.inferTransitivelyDefault,
224 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault, 215 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault,
225 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, 216 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false,
226 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, 217 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE,
227 this.emitSourceMaps: true, this.entryPointFile: null, 218 this.emitSourceMaps: true, this.entryPointFile: null,
228 this.serverMode: false, this.useImplicitHtml: false, 219 this.serverMode: false, this.useImplicitHtml: false,
229 this.enableHashing: false, this.host: 'localhost', this.port: 8080, 220 this.enableHashing: false, this.host: 'localhost', this.port: 8080,
230 this.runtimeDir, this.customUrlMappings: const {}}); 221 this.runtimeDir, this.customUrlMappings: const {}});
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 267
277 var entryPointFile = args.rest.length == 0 ? null : args.rest.first; 268 var entryPointFile = args.rest.length == 0 ? null : args.rest.first;
278 269
279 return new CompilerOptions( 270 return new CompilerOptions(
280 checkSdk: args['sdk-check'], 271 checkSdk: args['sdk-check'],
281 dumpInfo: dumpInfo, 272 dumpInfo: dumpInfo,
282 dumpInfoFile: args['dump-info-file'], 273 dumpInfoFile: args['dump-info-file'],
283 forceCompile: args['force-compile'] || serverMode, 274 forceCompile: args['force-compile'] || serverMode,
284 ignoreTypes: args['ignore-types'], 275 ignoreTypes: args['ignore-types'],
285 outputDir: outputDir, 276 outputDir: outputDir,
286 covariantGenerics: args['covariant-generics'],
287 relaxedCasts: args['relaxed-casts'], 277 relaxedCasts: args['relaxed-casts'],
288 useColors: useColors, 278 useColors: useColors,
289 customUrlMappings: customUrlMappings, 279 customUrlMappings: customUrlMappings,
290 useMultiPackage: args['use-multi-package'], 280 useMultiPackage: args['use-multi-package'],
291 packageRoot: args['package-root'], 281 packageRoot: args['package-root'],
292 packagePaths: args['package-paths'].split(','), 282 packagePaths: args['package-paths'].split(','),
293 resources: args['resources'] 283 resources: args['resources']
294 .split(',') 284 .split(',')
295 .where((s) => s.isNotEmpty) 285 .where((s) => s.isNotEmpty)
296 .toList(), 286 .toList(),
(...skipping 16 matching lines...) Expand all
313 port: int.parse(args['port']), 303 port: int.parse(args['port']),
314 runtimeDir: runtimeDir); 304 runtimeDir: runtimeDir);
315 } 305 }
316 306
317 final ArgParser argParser = new ArgParser() 307 final ArgParser argParser = new ArgParser()
318 // resolver/checker options 308 // resolver/checker options
319 ..addFlag('sdk-check', 309 ..addFlag('sdk-check',
320 abbr: 's', help: 'Typecheck sdk libs', defaultsTo: false) 310 abbr: 's', help: 'Typecheck sdk libs', defaultsTo: false)
321 ..addFlag('mock-sdk', 311 ..addFlag('mock-sdk',
322 abbr: 'm', help: 'Use a mock Dart SDK', defaultsTo: false) 312 abbr: 'm', help: 'Use a mock Dart SDK', defaultsTo: false)
323 ..addFlag('covariant-generics',
324 help: 'Use covariant generics', defaultsTo: true)
325 ..addFlag('ignore-types', 313 ..addFlag('ignore-types',
326 help: 'Ignore types during codegen', defaultsTo: false) 314 help: 'Ignore types during codegen', defaultsTo: false)
327 ..addFlag('relaxed-casts', 315 ..addFlag('relaxed-casts',
328 help: 'Cast between Dart assignable types', defaultsTo: true) 316 help: 'Cast between Dart assignable types', defaultsTo: true)
329 ..addOption('nonnullable', 317 ..addOption('nonnullable',
330 abbr: 'n', 318 abbr: 'n',
331 help: 'Comma separated string of non-nullable types', 319 help: 'Comma separated string of non-nullable types',
332 defaultsTo: null) 320 defaultsTo: null)
333 ..addFlag('infer-downwards', 321 ..addFlag('infer-downwards',
334 help: 'Infer types downwards from local context', 322 help: 'Infer types downwards from local context',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // The pub-cache directory is two levels up, but we verify that the layout 423 // The pub-cache directory is two levels up, but we verify that the layout
436 // looks correct. 424 // looks correct.
437 if (path.basename(dir) != 'dev_compiler') return null; 425 if (path.basename(dir) != 'dev_compiler') return null;
438 dir = path.dirname(dir); 426 dir = path.dirname(dir);
439 if (path.basename(dir) != 'global_packages') return null; 427 if (path.basename(dir) != 'global_packages') return null;
440 dir = path.dirname(dir); 428 dir = path.dirname(dir);
441 return path.join(dir, cacheDir, 'lib', 'runtime'); 429 return path.join(dir, cacheDir, 'lib', 'runtime');
442 } 430 }
443 return null; 431 return null;
444 } 432 }
OLDNEW
« no previous file with comments | « lib/src/checker/rules.dart ('k') | lib/src/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698