| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 final bool analyzeOnly; | 196 final bool analyzeOnly; |
| 197 final bool enableNativeLiveTypeAnalysis; | 197 final bool enableNativeLiveTypeAnalysis; |
| 198 final bool rejectDeprecatedFeatures; | 198 final bool rejectDeprecatedFeatures; |
| 199 final bool checkDeprecationInSdk; | 199 final bool checkDeprecationInSdk; |
| 200 | 200 |
| 201 /** | 201 /** |
| 202 * If [:true:], comment tokens are collected in [commentMap] during scanning. | 202 * If [:true:], comment tokens are collected in [commentMap] during scanning. |
| 203 */ | 203 */ |
| 204 final bool preserveComments; | 204 final bool preserveComments; |
| 205 | 205 |
| 206 final api.CompilerOutputProvider outputProvider; |
| 207 |
| 206 bool disableInlining = false; | 208 bool disableInlining = false; |
| 207 | 209 |
| 208 List<Uri> librariesToAnalyzeWhenRun; | 210 List<Uri> librariesToAnalyzeWhenRun; |
| 209 | 211 |
| 210 final Tracer tracer; | 212 final Tracer tracer; |
| 211 | 213 |
| 212 CompilerTask measuredTask; | 214 CompilerTask measuredTask; |
| 213 Element _currentElement; | 215 Element _currentElement; |
| 214 LibraryElement coreLibrary; | 216 LibraryElement coreLibrary; |
| 215 LibraryElement isolateLibrary; | 217 LibraryElement isolateLibrary; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 this.enableMinification: false, | 326 this.enableMinification: false, |
| 325 this.enableNativeLiveTypeAnalysis: false, | 327 this.enableNativeLiveTypeAnalysis: false, |
| 326 bool emitJavaScript: true, | 328 bool emitJavaScript: true, |
| 327 bool generateSourceMap: true, | 329 bool generateSourceMap: true, |
| 328 bool disallowUnsafeEval: false, | 330 bool disallowUnsafeEval: false, |
| 329 this.analyzeAll: false, | 331 this.analyzeAll: false, |
| 330 this.analyzeOnly: false, | 332 this.analyzeOnly: false, |
| 331 this.rejectDeprecatedFeatures: false, | 333 this.rejectDeprecatedFeatures: false, |
| 332 this.checkDeprecationInSdk: false, | 334 this.checkDeprecationInSdk: false, |
| 333 this.preserveComments: false, | 335 this.preserveComments: false, |
| 336 outputProvider, |
| 334 List<String> strips: const []}) | 337 List<String> strips: const []}) |
| 335 : libraries = new Map<String, LibraryElement>(), | 338 : libraries = new Map<String, LibraryElement>(), |
| 336 progress = new Stopwatch() { | 339 progress = new Stopwatch(), |
| 340 this.outputProvider = |
| 341 (outputProvider == null) ? NullSink.outputProvider : outputProvider |
| 342 { |
| 337 progress.start(); | 343 progress.start(); |
| 338 world = new World(this); | 344 world = new World(this); |
| 339 | 345 |
| 340 closureMapping.ClosureNamer closureNamer; | 346 closureMapping.ClosureNamer closureNamer; |
| 341 if (emitJavaScript) { | 347 if (emitJavaScript) { |
| 342 js_backend.JavaScriptBackend jsBackend = | 348 js_backend.JavaScriptBackend jsBackend = |
| 343 new js_backend.JavaScriptBackend(this, generateSourceMap, | 349 new js_backend.JavaScriptBackend(this, generateSourceMap, |
| 344 disallowUnsafeEval); | 350 disallowUnsafeEval); |
| 345 closureNamer = jsBackend.namer; | 351 closureNamer = jsBackend.namer; |
| 346 backend = jsBackend; | 352 backend = jsBackend; |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 1086 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 1081 // information on assertion errors. | 1087 // information on assertion errors. |
| 1082 if (condition is Function){ | 1088 if (condition is Function){ |
| 1083 condition = condition(); | 1089 condition = condition(); |
| 1084 } | 1090 } |
| 1085 if (spannable == null || !condition) { | 1091 if (spannable == null || !condition) { |
| 1086 throw new SpannableAssertionFailure(spannable, message); | 1092 throw new SpannableAssertionFailure(spannable, message); |
| 1087 } | 1093 } |
| 1088 return true; | 1094 return true; |
| 1089 } | 1095 } |
| 1096 |
| 1097 /// A sink that drains into /dev/null. |
| 1098 class NullSink extends Sink<String> { |
| 1099 final String name; |
| 1100 |
| 1101 NullSink(this.name); |
| 1102 |
| 1103 add(String value) {} |
| 1104 |
| 1105 void close() {} |
| 1106 |
| 1107 toString() => name; |
| 1108 |
| 1109 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1110 static NullSink outputProvider(String name, String extension) { |
| 1111 return new NullSink('$name.$extension'); |
| 1112 } |
| 1113 } |
| OLD | NEW |