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 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 final bool analyzeAll; | 167 final bool analyzeAll; |
| 168 final bool enableNativeLiveTypeAnalysis; | 168 final bool enableNativeLiveTypeAnalysis; |
| 169 final bool rejectDeprecatedFeatures; | 169 final bool rejectDeprecatedFeatures; |
| 170 final bool checkDeprecationInSdk; | 170 final bool checkDeprecationInSdk; |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * If [:true:], comment tokens are collected in [commentMap] during scanning. | 173 * If [:true:], comment tokens are collected in [commentMap] during scanning. |
| 174 */ | 174 */ |
| 175 final bool preserveComments; | 175 final bool preserveComments; |
| 176 | 176 |
| 177 final api.CompilerOutputProvider outputProvider; | |
| 178 | |
| 177 bool disableInlining = false; | 179 bool disableInlining = false; |
| 178 | 180 |
| 179 final Tracer tracer; | 181 final Tracer tracer; |
| 180 | 182 |
| 181 CompilerTask measuredTask; | 183 CompilerTask measuredTask; |
| 182 Element _currentElement; | 184 Element _currentElement; |
| 183 LibraryElement coreLibrary; | 185 LibraryElement coreLibrary; |
| 184 LibraryElement isolateLibrary; | 186 LibraryElement isolateLibrary; |
| 185 LibraryElement isolateHelperLibrary; | 187 LibraryElement isolateHelperLibrary; |
| 186 LibraryElement jsHelperLibrary; | 188 LibraryElement jsHelperLibrary; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 this.maxConcreteTypeSize: 5, | 294 this.maxConcreteTypeSize: 5, |
| 293 this.enableMinification: false, | 295 this.enableMinification: false, |
| 294 this.enableNativeLiveTypeAnalysis: false, | 296 this.enableNativeLiveTypeAnalysis: false, |
| 295 bool emitJavaScript: true, | 297 bool emitJavaScript: true, |
| 296 bool generateSourceMap: true, | 298 bool generateSourceMap: true, |
| 297 bool disallowUnsafeEval: false, | 299 bool disallowUnsafeEval: false, |
| 298 this.analyzeAll: false, | 300 this.analyzeAll: false, |
| 299 this.rejectDeprecatedFeatures: false, | 301 this.rejectDeprecatedFeatures: false, |
| 300 this.checkDeprecationInSdk: false, | 302 this.checkDeprecationInSdk: false, |
| 301 this.preserveComments: false, | 303 this.preserveComments: false, |
| 304 outputProvider, | |
| 302 List<String> strips: const []}) | 305 List<String> strips: const []}) |
| 303 : libraries = new Map<String, LibraryElement>(), | 306 : libraries = new Map<String, LibraryElement>(), |
| 304 progress = new Stopwatch() { | 307 progress = new Stopwatch(), |
| 308 this.outputProvider = | |
| 309 (outputProvider == null) ? NullSink.outputProvider : outputProvider | |
| 310 { | |
| 305 progress.start(); | 311 progress.start(); |
| 306 world = new World(this); | 312 world = new World(this); |
| 307 | 313 |
| 308 closureMapping.ClosureNamer closureNamer; | 314 closureMapping.ClosureNamer closureNamer; |
| 309 if (emitJavaScript) { | 315 if (emitJavaScript) { |
| 310 js_backend.JavaScriptBackend jsBackend = | 316 js_backend.JavaScriptBackend jsBackend = |
| 311 new js_backend.JavaScriptBackend(this, generateSourceMap, | 317 new js_backend.JavaScriptBackend(this, generateSourceMap, |
| 312 disallowUnsafeEval); | 318 disallowUnsafeEval); |
| 313 closureNamer = jsBackend.namer; | 319 closureNamer = jsBackend.namer; |
| 314 backend = jsBackend; | 320 backend = jsBackend; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1072 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 1078 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 1073 // information on assertion errors. | 1079 // information on assertion errors. |
| 1074 if (condition is Function){ | 1080 if (condition is Function){ |
| 1075 condition = condition(); | 1081 condition = condition(); |
| 1076 } | 1082 } |
| 1077 if (spannable == null || !condition) { | 1083 if (spannable == null || !condition) { |
| 1078 throw new SpannableAssertionFailure(spannable, message); | 1084 throw new SpannableAssertionFailure(spannable, message); |
| 1079 } | 1085 } |
| 1080 return true; | 1086 return true; |
| 1081 } | 1087 } |
| 1088 | |
| 1089 /// A sink that drains into /dev/null. | |
|
ngeoffray
2013/01/10 12:15:21
Really?
ahe
2013/01/25 15:50:09
For all intents and purposes. If you can observe t
| |
| 1090 class NullSink extends Sink<String> { | |
| 1091 final String name; | |
| 1092 | |
| 1093 NullSink(this.name); | |
| 1094 | |
| 1095 add(String value) {} | |
| 1096 | |
| 1097 void close() {} | |
| 1098 | |
| 1099 toString() => name; | |
| 1100 | |
| 1101 /// Convenience method for getting an [api.CompilerOutputProvider]. | |
| 1102 static outputProvider(String name, String extension) { | |
|
ngeoffray
2013/01/10 12:15:21
Use the typedef for the return type?
ahe
2013/01/25 15:50:09
Done.
| |
| 1103 return new NullSink('$name.$extension'); | |
| 1104 } | |
| 1105 } | |
| OLD | NEW |