Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** General options used by the compiler. */ | 5 /** General options used by the compiler. */ |
| 6 FrogOptions options; | 6 FrogOptions options; |
| 7 | 7 |
| 8 /** Extracts options from command-line arguments. */ | 8 /** Extracts options from command-line arguments. */ |
| 9 void parseOptions(String homedir, List<String> args, FileSystem files) { | 9 void parseOptions(String homedir, List<String> args, FileSystem files) { |
| 10 assert(options == null); | 10 assert(options == null); |
| 11 options = new FrogOptions(homedir, args, files); | 11 options = new FrogOptions(homedir, args, files); |
| 12 } | 12 } |
| 13 | 13 |
| 14 // TODO(sigmund): make into a generic option parser... | 14 // TODO(sigmund): make into a generic option parser... |
| 15 class FrogOptions { | 15 class FrogOptions { |
| 16 /** Location of corelib and other special dart libraries. */ | 16 /** Location of corelib and other special dart libraries. */ |
| 17 String libDir; | 17 String libDir; |
| 18 | 18 |
| 19 /* The top-level dart script to compile. */ | 19 /* The top-level dart script to compile. */ |
| 20 String dartScript; | 20 String dartScript; |
| 21 | 21 |
| 22 /** Where to place the generated code. */ | 22 /** Where to place the generated code. */ |
| 23 String outfile; | 23 String outfile; |
| 24 | 24 |
| 25 // TODO(dgrove): fix this. For now, either 'sdk' or 'dev'. | 25 // TODO(dgrove): fix this. For now, either 'sdk' or 'dev'. |
| 26 final config = 'dev'; | 26 final config = 'dev'; |
| 27 | 27 |
| 28 // Options that modify behavior significantly | 28 // Options that modify behavior significantly |
| 29 bool legOnly = false; | 29 bool legOnly = false; |
| 30 bool allowMockCompilation = false; | |
|
ngeoffray
2012/03/22 10:04:39
Good catch :)
| |
| 30 bool enableAsserts = false; | 31 bool enableAsserts = false; |
| 31 bool enableTypeChecks = false; | 32 bool enableTypeChecks = false; |
| 32 bool warningsAsErrors = false; | 33 bool warningsAsErrors = false; |
| 33 bool verifyImplements = false; // TODO(jimhug): Implement | 34 bool verifyImplements = false; // TODO(jimhug): Implement |
| 34 bool compileAll = false; | 35 bool compileAll = false; |
| 35 bool forceDynamic = false; | 36 bool forceDynamic = false; |
| 36 bool dietParse = false; | 37 bool dietParse = false; |
| 37 bool compileOnly = false; | 38 bool compileOnly = false; |
| 38 bool inferTypes = false; | 39 bool inferTypes = false; |
| 39 bool checkOnly = false; | 40 bool checkOnly = false; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 | 109 |
| 109 bool tryParseSimpleOption(String option) { | 110 bool tryParseSimpleOption(String option) { |
| 110 if (!option.startsWith('--')) return false; | 111 if (!option.startsWith('--')) return false; |
| 111 switch (option.replaceAll('_', '-')) { | 112 switch (option.replaceAll('_', '-')) { |
| 112 case '--leg': | 113 case '--leg': |
| 113 case '--enable-leg': | 114 case '--enable-leg': |
| 114 case '--leg-only': | 115 case '--leg-only': |
| 115 legOnly = true; | 116 legOnly = true; |
| 116 return true; | 117 return true; |
| 117 | 118 |
| 119 case '--allow-mock-compilation': | |
| 120 allowMockCompilation = true; | |
| 121 return true; | |
| 122 | |
| 118 case '--enable-asserts': | 123 case '--enable-asserts': |
| 119 enableAsserts = true; | 124 enableAsserts = true; |
| 120 return true; | 125 return true; |
| 121 | 126 |
| 122 case '--enable-type-checks': | 127 case '--enable-type-checks': |
| 123 enableTypeChecks = true; | 128 enableTypeChecks = true; |
| 124 enableAsserts = true; // TODO(kasperl): Remove once VM stops. | 129 enableAsserts = true; // TODO(kasperl): Remove once VM stops. |
| 125 return true; | 130 return true; |
| 126 | 131 |
| 127 case '--verify-implements': | 132 case '--verify-implements': |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 enableAsserts = true; | 192 enableAsserts = true; |
| 188 return true; | 193 return true; |
| 189 | 194 |
| 190 case '--unchecked': | 195 case '--unchecked': |
| 191 disableBoundsChecks = true; | 196 disableBoundsChecks = true; |
| 192 return true; | 197 return true; |
| 193 } | 198 } |
| 194 return false; | 199 return false; |
| 195 } | 200 } |
| 196 } | 201 } |
| OLD | NEW |