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 | 28 |
| 29 // Options that modify behavior significantly | 29 // Options that modify behavior significantly |
| 30 bool enableLeg = false; | |
| 31 bool legOnly = false; | 30 bool legOnly = false; |
| 32 bool enableAsserts = false; | 31 bool enableAsserts = false; |
| 33 bool enableTypeChecks = false; | 32 bool enableTypeChecks = false; |
| 34 bool warningsAsErrors = false; | 33 bool warningsAsErrors = false; |
| 35 bool verifyImplements = false; // TODO(jimhug): Implement | 34 bool verifyImplements = false; // TODO(jimhug): Implement |
| 36 bool compileAll = false; | 35 bool compileAll = false; |
| 37 bool forceDynamic = false; | 36 bool forceDynamic = false; |
| 38 bool dietParse = false; | 37 bool dietParse = false; |
| 39 bool compileOnly = false; | 38 bool compileOnly = false; |
| 40 bool inferTypes = false; | 39 bool inferTypes = false; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 bool ignoreUnrecognizedFlags = false; | 75 bool ignoreUnrecognizedFlags = false; |
| 77 bool passedLibDir = false; | 76 bool passedLibDir = false; |
| 78 childArgs = []; | 77 childArgs = []; |
| 79 | 78 |
| 80 // Start from 2 to skip arguments representing the compiler command | 79 // Start from 2 to skip arguments representing the compiler command |
| 81 // (node/python followed by frogsh/frog.py). | 80 // (node/python followed by frogsh/frog.py). |
| 82 loop: for (int i = 2; i < args.length; i++) { | 81 loop: for (int i = 2; i < args.length; i++) { |
| 83 var arg = args[i]; | 82 var arg = args[i]; |
| 84 | 83 |
| 85 switch (arg) { | 84 switch (arg) { |
| 85 case '--leg': | |
|
ngeoffray
2012/02/09 09:14:21
Should we remove the other flags?
ahe
2012/02/09 10:05:33
In a few days. Right now we have an open VM bug th
| |
| 86 case '--enable_leg': | 86 case '--enable_leg': |
| 87 enableLeg = true; | |
| 88 break; | |
| 89 | |
| 90 case '--leg_only': | 87 case '--leg_only': |
| 91 enableLeg = true; | |
| 92 legOnly = true; | 88 legOnly = true; |
| 93 break; | 89 break; |
| 94 | 90 |
| 95 case '--enable_asserts': | 91 case '--enable_asserts': |
| 96 enableAsserts = true; | 92 enableAsserts = true; |
| 97 break; | 93 break; |
| 98 | 94 |
| 99 case '--enable_type_checks': | 95 case '--enable_type_checks': |
| 100 enableTypeChecks = true; | 96 enableTypeChecks = true; |
| 101 // This flag also enables asserts in VM | 97 // This flag also enables asserts in VM |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 // Try locally | 187 // Try locally |
| 192 var temp = 'frog/lib'; | 188 var temp = 'frog/lib'; |
| 193 if (files.fileExists(temp)) { | 189 if (files.fileExists(temp)) { |
| 194 libDir = temp; | 190 libDir = temp; |
| 195 } else { | 191 } else { |
| 196 libDir = 'lib'; | 192 libDir = 'lib'; |
| 197 } | 193 } |
| 198 } | 194 } |
| 199 } | 195 } |
| 200 } | 196 } |
| OLD | NEW |