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 #library('leg_apiimpl'); | 5 #library('leg_apiimpl'); |
| 6 | 6 |
| 7 #import('dart:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../compiler.dart', prefix: 'api'); | 9 #import('../compiler.dart', prefix: 'api'); |
| 10 #import('leg.dart', prefix: 'leg'); | 10 #import('leg.dart', prefix: 'leg'); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 Compiler(this.provider, this.handler, this.libraryRoot, this.packageRoot, | 25 Compiler(this.provider, this.handler, this.libraryRoot, this.packageRoot, |
| 26 List<String> options) | 26 List<String> options) |
| 27 : this.options = options, | 27 : this.options = options, |
| 28 super( | 28 super( |
| 29 tracer: new ssa.HTracer(), | 29 tracer: new ssa.HTracer(), |
| 30 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), | 30 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), |
| 31 enableUserAssertions: hasOption(options, '--enable-checked-mode'), | 31 enableUserAssertions: hasOption(options, '--enable-checked-mode'), |
| 32 enableMinification: hasOption(options, '--minify'), | 32 enableMinification: hasOption(options, '--minify'), |
| 33 emitJavaScript: !hasOption(options, '--output-type=dart'), | 33 emitJavaScript: !hasOption(options, '--output-type=dart'), |
| 34 forceCutDeclarationTypes: | 34 strips: getStrips(options)); |
| 35 hasOption(options, '--force-cut-declaration-types')); | 35 |
| 36 static List<String> getStrips(List<String> options) { | |
|
ahe
2012/10/01 10:19:22
I don't like this method, but I don't like the has
Roman
2012/10/03 12:24:26
I don't like it too. I agree, Map of args would ce
| |
| 37 for (String option in options) { | |
| 38 if (option.startsWith('--force-strip=')) { | |
| 39 return option.substring('--force-strip='.length).split(','); | |
| 40 } | |
| 41 } | |
| 42 return []; | |
| 43 } | |
| 36 | 44 |
| 37 static bool hasOption(List<String> options, String option) { | 45 static bool hasOption(List<String> options, String option) { |
| 38 return options.indexOf(option) >= 0; | 46 return options.indexOf(option) >= 0; |
| 39 } | 47 } |
| 40 | 48 |
| 41 String lookupLibraryPath(String dartLibraryName) { | 49 String lookupLibraryPath(String dartLibraryName) { |
| 42 LibraryInfo info = LIBRARIES[dartLibraryName]; | 50 LibraryInfo info = LIBRARIES[dartLibraryName]; |
| 43 if (info === null) return null; | 51 if (info === null) return null; |
| 44 if (!info.isDart2jsLibrary) return null; | 52 if (!info.isDart2jsLibrary) return null; |
| 45 String path = info.dart2jsPath; | 53 String path = info.dart2jsPath; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 handler(translateUri(span.uri, null), span.begin, span.end, | 153 handler(translateUri(span.uri, null), span.begin, span.end, |
| 146 message, kind); | 154 message, kind); |
| 147 } | 155 } |
| 148 } | 156 } |
| 149 | 157 |
| 150 bool get isMockCompilation { | 158 bool get isMockCompilation { |
| 151 return mockableLibraryUsed | 159 return mockableLibraryUsed |
| 152 && (options.indexOf('--allow-mock-compilation') !== -1); | 160 && (options.indexOf('--allow-mock-compilation') !== -1); |
| 153 } | 161 } |
| 154 } | 162 } |
| OLD | NEW |