| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
| 6 | 6 |
| 7 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; | 7 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; |
| 8 import com.google.dart.compiler.backend.isolate.DartIsolateStubGenerator; | 8 import com.google.dart.compiler.backend.isolate.DartIsolateStubGenerator; |
| 9 import com.google.dart.compiler.backend.js.ClosureJsBackend; | |
| 10 import com.google.dart.compiler.backend.js.JavascriptBackend; | 9 import com.google.dart.compiler.backend.js.JavascriptBackend; |
| 11 import com.google.dart.compiler.metrics.CompilerMetrics; | 10 import com.google.dart.compiler.metrics.CompilerMetrics; |
| 12 import com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer; | 11 import com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer; |
| 13 import com.google.dart.compiler.resolver.Resolver; | 12 import com.google.dart.compiler.resolver.Resolver; |
| 14 import com.google.dart.compiler.type.TypeAnalyzer; | 13 import com.google.dart.compiler.type.TypeAnalyzer; |
| 15 | 14 |
| 16 import java.io.File; | 15 import java.io.File; |
| 17 import java.io.FileNotFoundException; | 16 import java.io.FileNotFoundException; |
| 18 import java.net.URI; | 17 import java.net.URI; |
| 19 import java.net.URISyntaxException; | 18 import java.net.URISyntaxException; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 */ | 39 */ |
| 41 public DefaultCompilerConfiguration() { | 40 public DefaultCompilerConfiguration() { |
| 42 this(new JavascriptBackend()); | 41 this(new JavascriptBackend()); |
| 43 } | 42 } |
| 44 | 43 |
| 45 private static Backend selectBackend(CompilerOptions compilerOptions) | 44 private static Backend selectBackend(CompilerOptions compilerOptions) |
| 46 throws FileNotFoundException { | 45 throws FileNotFoundException { |
| 47 if (!compilerOptions.getIsolateStubClasses().isEmpty()) { | 46 if (!compilerOptions.getIsolateStubClasses().isEmpty()) { |
| 48 return new DartIsolateStubGenerator(compilerOptions.getIsolateStubClasses(
), | 47 return new DartIsolateStubGenerator(compilerOptions.getIsolateStubClasses(
), |
| 49 compilerOptions.getIsolateStubOutputFi
le()); | 48 compilerOptions.getIsolateStubOutputFi
le()); |
| 50 } else if (compilerOptions.shouldOptimize()) { | |
| 51 return new ClosureJsBackend( | |
| 52 compilerOptions.developerModeChecks(), | |
| 53 compilerOptions.generateHumanReadableOutput()); | |
| 54 } else { | 49 } else { |
| 55 return new JavascriptBackend(); | 50 return new JavascriptBackend(); |
| 56 } | 51 } |
| 57 } | 52 } |
| 58 | 53 |
| 59 /** | 54 /** |
| 60 * A new instance with the specified {@link CompilerOptions} | 55 * A new instance with the specified {@link CompilerOptions} |
| 61 * @throws FileNotFoundException | 56 * @throws FileNotFoundException |
| 62 */ | 57 */ |
| 63 public DefaultCompilerConfiguration(CompilerOptions compilerOptions) | 58 public DefaultCompilerConfiguration(CompilerOptions compilerOptions) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 public List<Backend> getBackends() { | 122 public List<Backend> getBackends() { |
| 128 return backends; | 123 return backends; |
| 129 } | 124 } |
| 130 | 125 |
| 131 @Override | 126 @Override |
| 132 public boolean developerModeChecks() { | 127 public boolean developerModeChecks() { |
| 133 return compilerOptions.developerModeChecks(); | 128 return compilerOptions.developerModeChecks(); |
| 134 } | 129 } |
| 135 | 130 |
| 136 @Override | 131 @Override |
| 137 public boolean shouldOptimize() { | |
| 138 return compilerOptions.shouldOptimize(); | |
| 139 } | |
| 140 | |
| 141 @Override | |
| 142 public CompilerMetrics getCompilerMetrics() { | 132 public CompilerMetrics getCompilerMetrics() { |
| 143 return compilerMetrics; | 133 return compilerMetrics; |
| 144 } | 134 } |
| 145 | 135 |
| 146 @Override | 136 @Override |
| 147 public String getJvmMetricOptions() { | 137 public String getJvmMetricOptions() { |
| 148 return compilerOptions.getJvmMetricOptions(); | 138 return compilerOptions.getJvmMetricOptions(); |
| 149 } | 139 } |
| 150 | 140 |
| 151 @Override | 141 @Override |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 @Override | 202 @Override |
| 213 public CompilerOptions getCompilerOptions() { | 203 public CompilerOptions getCompilerOptions() { |
| 214 return compilerOptions; | 204 return compilerOptions; |
| 215 } | 205 } |
| 216 | 206 |
| 217 @Override | 207 @Override |
| 218 public ErrorFormat printErrorFormat() { | 208 public ErrorFormat printErrorFormat() { |
| 219 return compilerOptions.printErrorFormat(); | 209 return compilerOptions.printErrorFormat(); |
| 220 } | 210 } |
| 221 } | 211 } |
| OLD | NEW |