Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 | 164 |
| 165 /// Hoist types from class signatures | 165 /// Hoist types from class signatures |
| 166 final bool hoistSignatureTypes; | 166 final bool hoistSignatureTypes; |
| 167 | 167 |
| 168 /// Name types in type tests | 168 /// Name types in type tests |
| 169 final bool nameTypeTests; | 169 final bool nameTypeTests; |
| 170 | 170 |
| 171 /// Hoist types in type tests | 171 /// Hoist types in type tests |
| 172 final bool hoistTypeTests; | 172 final bool hoistTypeTests; |
| 173 | 173 |
| 174 final bool useUncheckedWhitelist; | |
| 175 | |
| 174 /// Enable ES6 destructuring of named parameters. Off by default. | 176 /// Enable ES6 destructuring of named parameters. Off by default. |
| 175 /// | 177 /// |
| 176 /// Older V8 versions do not accept default values with destructuring in | 178 /// Older V8 versions do not accept default values with destructuring in |
| 177 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them | 179 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them |
| 178 /// with regular functions (e.g. `function({a} = {}) { return 1 }`). | 180 /// with regular functions (e.g. `function({a} = {}) { return 1 }`). |
| 179 /// | 181 /// |
| 180 /// Supporting the syntax: | 182 /// Supporting the syntax: |
| 181 /// * Chrome Canary (51) | 183 /// * Chrome Canary (51) |
| 182 /// * Firefox | 184 /// * Firefox |
| 183 /// | 185 /// |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 196 this.sourceMapComment: true, | 198 this.sourceMapComment: true, |
| 197 this.summarizeApi: true, | 199 this.summarizeApi: true, |
| 198 this.unsafeForceCompile: false, | 200 this.unsafeForceCompile: false, |
| 199 this.emitMetadata: false, | 201 this.emitMetadata: false, |
| 200 this.closure: false, | 202 this.closure: false, |
| 201 this.destructureNamedParams: false, | 203 this.destructureNamedParams: false, |
| 202 this.moduleFormat: ModuleFormat.legacy, | 204 this.moduleFormat: ModuleFormat.legacy, |
| 203 this.hoistInstanceCreation: true, | 205 this.hoistInstanceCreation: true, |
| 204 this.hoistSignatureTypes: false, | 206 this.hoistSignatureTypes: false, |
| 205 this.nameTypeTests: true, | 207 this.nameTypeTests: true, |
| 206 this.hoistTypeTests: true}); | 208 this.hoistTypeTests: true, |
| 209 this.useUncheckedWhitelist: false}); | |
| 207 | 210 |
| 208 CompilerOptions.fromArguments(ArgResults args) | 211 CompilerOptions.fromArguments(ArgResults args) |
| 209 : sourceMap = args['source-map'], | 212 : sourceMap = args['source-map'], |
| 210 sourceMapComment = args['source-map-comment'], | 213 sourceMapComment = args['source-map-comment'], |
| 211 summarizeApi = args['summarize'], | 214 summarizeApi = args['summarize'], |
| 212 unsafeForceCompile = args['unsafe-force-compile'], | 215 unsafeForceCompile = args['unsafe-force-compile'], |
| 213 emitMetadata = args['emit-metadata'], | 216 emitMetadata = args['emit-metadata'], |
| 214 closure = args['closure-experimental'], | 217 closure = args['closure-experimental'], |
| 215 destructureNamedParams = args['destructure-named-params'], | 218 destructureNamedParams = args['destructure-named-params'], |
| 216 moduleFormat = parseModuleFormat(args['modules']), | 219 moduleFormat = parseModuleFormat(args['modules']), |
| 217 hoistInstanceCreation = args['hoist-instance-creation'], | 220 hoistInstanceCreation = args['hoist-instance-creation'], |
| 218 hoistSignatureTypes = args['hoist-signature-types'], | 221 hoistSignatureTypes = args['hoist-signature-types'], |
| 219 nameTypeTests = args['name-type-tests'], | 222 nameTypeTests = args['name-type-tests'], |
| 220 hoistTypeTests = args['hoist-type-tests']; | 223 hoistTypeTests = args['hoist-type-tests'], |
| 224 useUncheckedWhitelist = args['use-unchecked-whitelist']; | |
| 221 | 225 |
| 222 static ArgParser addArguments(ArgParser parser) => parser | 226 static ArgParser addArguments(ArgParser parser) => parser |
| 223 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) | 227 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) |
| 224 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) | 228 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) |
| 225 ..addFlag('source-map-comment', | 229 ..addFlag('source-map-comment', |
| 226 help: 'adds a sourceMappingURL comment to the end of the JS,\n' | 230 help: 'adds a sourceMappingURL comment to the end of the JS,\n' |
| 227 'disable if using X-SourceMap header', | 231 'disable if using X-SourceMap header', |
| 228 defaultsTo: true) | 232 defaultsTo: true) |
| 229 ..addOption('modules', | 233 ..addOption('modules', |
| 230 help: 'module pattern to emit', | 234 help: 'module pattern to emit', |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 248 'This has undefined behavior!', | 252 'This has undefined behavior!', |
| 249 defaultsTo: false) | 253 defaultsTo: false) |
| 250 ..addFlag('hoist-instance-creation', | 254 ..addFlag('hoist-instance-creation', |
| 251 help: 'Hoist the class type from generic instance creations', | 255 help: 'Hoist the class type from generic instance creations', |
| 252 defaultsTo: true) | 256 defaultsTo: true) |
| 253 ..addFlag('hoist-signature-types', | 257 ..addFlag('hoist-signature-types', |
| 254 help: 'Hoist types from class signatures', defaultsTo: false) | 258 help: 'Hoist types from class signatures', defaultsTo: false) |
| 255 ..addFlag('name-type-tests', | 259 ..addFlag('name-type-tests', |
| 256 help: 'Name types used in type tests', defaultsTo: true) | 260 help: 'Name types used in type tests', defaultsTo: true) |
| 257 ..addFlag('hoist-type-tests', | 261 ..addFlag('hoist-type-tests', |
| 258 help: 'Hoist types used in type tests', defaultsTo: true); | 262 help: 'Hoist types used in type tests', defaultsTo: true) |
| 263 ..addFlag('use-unchecked-whitelist', defaultsTo: false, hide: true); | |
|
vsm
2016/06/01 19:02:14
How about 'unsafe-angular2-whitelist' ?
Leaf
2016/06/01 20:04:05
Done.
| |
| 259 } | 264 } |
| 260 | 265 |
| 261 /// A unit of Dart code that can be built into a single JavaScript module. | 266 /// A unit of Dart code that can be built into a single JavaScript module. |
| 262 class BuildUnit { | 267 class BuildUnit { |
| 263 /// The name of this module. | 268 /// The name of this module. |
| 264 final String name; | 269 final String name; |
| 265 | 270 |
| 266 /// Build root. All library names are relative to this path/prefix. | 271 /// Build root. All library names are relative to this path/prefix. |
| 267 final String buildRoot; | 272 final String buildRoot; |
| 268 | 273 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 } | 342 } |
| 338 } | 343 } |
| 339 | 344 |
| 340 /// (Public for tests) the error code used when a part is missing. | 345 /// (Public for tests) the error code used when a part is missing. |
| 341 final missingPartErrorCode = const CompileTimeErrorCode( | 346 final missingPartErrorCode = const CompileTimeErrorCode( |
| 342 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); | 347 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); |
| 343 | 348 |
| 344 /// (Public for tests) the error code used when a part is unused. | 349 /// (Public for tests) the error code used when a part is unused. |
| 345 final unusedPartWarningCode = const StaticWarningCode( | 350 final unusedPartWarningCode = const StaticWarningCode( |
| 346 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); | 351 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); |
| OLD | NEW |