| 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 | 5 |
| 6 /** | 6 /** |
| 7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
| 8 * compiled. | 8 * compiled. |
| 9 */ | 9 */ |
| 10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 static const int PHASE_SCANNING = 0; | 187 static const int PHASE_SCANNING = 0; |
| 188 static const int PHASE_RESOLVING = 1; | 188 static const int PHASE_RESOLVING = 1; |
| 189 static const int PHASE_COMPILING = 2; | 189 static const int PHASE_COMPILING = 2; |
| 190 int phase; | 190 int phase; |
| 191 | 191 |
| 192 bool compilationFailed = false; | 192 bool compilationFailed = false; |
| 193 | 193 |
| 194 bool hasCrashed = false; | 194 bool hasCrashed = false; |
| 195 | 195 |
| 196 Compiler([this.tracer = const Tracer(), | 196 Compiler({this.tracer: const Tracer(), |
| 197 this.enableTypeAssertions = false, | 197 this.enableTypeAssertions: false, |
| 198 this.enableUserAssertions = false, | 198 this.enableUserAssertions: false, |
| 199 this.enableMinification = false, | 199 this.enableMinification: false, |
| 200 bool emitJavaScript = true, | 200 bool emitJavaScript: true, |
| 201 bool generateSourceMap = true, | 201 bool generateSourceMap: true, |
| 202 List<String> strips = const []]) | 202 List<String> strips: const []}) |
| 203 : libraries = new Map<String, LibraryElement>(), | 203 : libraries = new Map<String, LibraryElement>(), |
| 204 progress = new Stopwatch() { | 204 progress = new Stopwatch() { |
| 205 progress.start(); | 205 progress.start(); |
| 206 world = new World(this); | 206 world = new World(this); |
| 207 scanner = new ScannerTask(this); | 207 scanner = new ScannerTask(this); |
| 208 dietParser = new DietParserTask(this); | 208 dietParser = new DietParserTask(this); |
| 209 parser = new ParserTask(this); | 209 parser = new ParserTask(this); |
| 210 patchParser = new PatchParserTask(this); | 210 patchParser = new PatchParserTask(this); |
| 211 libraryLoader = new LibraryLoaderTask(this); | 211 libraryLoader = new LibraryLoaderTask(this); |
| 212 validator = new TreeValidatorTask(this); | 212 validator = new TreeValidatorTask(this); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 void unhandledExceptionOnElement(Element element) { | 253 void unhandledExceptionOnElement(Element element) { |
| 254 if (hasCrashed) return; | 254 if (hasCrashed) return; |
| 255 hasCrashed = true; | 255 hasCrashed = true; |
| 256 reportDiagnostic(spanFromElement(element), | 256 reportDiagnostic(spanFromElement(element), |
| 257 MessageKind.COMPILER_CRASHED.error().toString(), | 257 MessageKind.COMPILER_CRASHED.error().toString(), |
| 258 api.Diagnostic.CRASH); | 258 api.Diagnostic.CRASH); |
| 259 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([BUILD_ID])); | 259 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([BUILD_ID])); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void cancel([String reason, Node node, Token token, | 262 void cancel(String reason, {Node node, Token token, |
| 263 HInstruction instruction, Element element]) { | 263 HInstruction instruction, Element element}) { |
| 264 assembledCode = null; // Compilation failed. Make sure that we | 264 assembledCode = null; // Compilation failed. Make sure that we |
| 265 // don't return a bogus result. | 265 // don't return a bogus result. |
| 266 SourceSpan span = null; | 266 SourceSpan span = null; |
| 267 if (node !== null) { | 267 if (node !== null) { |
| 268 span = spanFromNode(node); | 268 span = spanFromNode(node); |
| 269 } else if (token !== null) { | 269 } else if (token !== null) { |
| 270 span = spanFromTokens(token, token); | 270 span = spanFromTokens(token, token); |
| 271 } else if (instruction !== null) { | 271 } else if (instruction !== null) { |
| 272 span = spanFromElement(currentElement); | 272 span = spanFromElement(currentElement); |
| 273 } else if (element !== null) { | 273 } else if (element !== null) { |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 846 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 847 // information on assertion errors. | 847 // information on assertion errors. |
| 848 if (condition is Function){ | 848 if (condition is Function){ |
| 849 condition = condition(); | 849 condition = condition(); |
| 850 } | 850 } |
| 851 if (!condition && message != null) { | 851 if (!condition && message != null) { |
| 852 print('assertion failed: $message'); | 852 print('assertion failed: $message'); |
| 853 } | 853 } |
| 854 return spannable != null && condition; | 854 return spannable != null && condition; |
| 855 } | 855 } |
| OLD | NEW |