| 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 final bool REPORT_EXCESS_RESOLUTION = false; | 10 final bool REPORT_EXCESS_RESOLUTION = false; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Stopwatch progress; | 141 Stopwatch progress; |
| 142 | 142 |
| 143 static final int PHASE_SCANNING = 0; | 143 static final int PHASE_SCANNING = 0; |
| 144 static final int PHASE_RESOLVING = 1; | 144 static final int PHASE_RESOLVING = 1; |
| 145 static final int PHASE_COMPILING = 2; | 145 static final int PHASE_COMPILING = 2; |
| 146 static final int PHASE_RECOMPILING = 3; | 146 static final int PHASE_RECOMPILING = 3; |
| 147 int phase; | 147 int phase; |
| 148 | 148 |
| 149 bool compilationFailed = false; | 149 bool compilationFailed = false; |
| 150 | 150 |
| 151 bool hasCrashed = false; |
| 152 |
| 151 Compiler([this.tracer = const Tracer(), | 153 Compiler([this.tracer = const Tracer(), |
| 152 this.enableTypeAssertions = false, | 154 this.enableTypeAssertions = false, |
| 153 this.enableUserAssertions = false, | 155 this.enableUserAssertions = false, |
| 154 bool emitJavascript = true, | 156 bool emitJavascript = true, |
| 155 validateUnparse = false, | 157 validateUnparse = false, |
| 156 generateSourceMap = true]) | 158 generateSourceMap = true]) |
| 157 : libraries = new Map<String, LibraryElement>(), | 159 : libraries = new Map<String, LibraryElement>(), |
| 158 world = new World(), | 160 world = new World(), |
| 159 progress = new Stopwatch.start() { | 161 progress = new Stopwatch.start() { |
| 160 namer = new Namer(this); | 162 namer = new Namer(this); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 [Node node, Token token, HInstruction instruction, | 198 [Node node, Token token, HInstruction instruction, |
| 197 Element element]) { | 199 Element element]) { |
| 198 cancel('Internal error: $message', node, token, instruction, element); | 200 cancel('Internal error: $message', node, token, instruction, element); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void internalErrorOnElement(Element element, String message) { | 203 void internalErrorOnElement(Element element, String message) { |
| 202 internalError(message, element: element); | 204 internalError(message, element: element); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void unhandledExceptionOnElement(Element element) { | 207 void unhandledExceptionOnElement(Element element) { |
| 208 if (hasCrashed) return; |
| 209 hasCrashed = true; |
| 206 reportDiagnostic(spanFromElement(element), | 210 reportDiagnostic(spanFromElement(element), |
| 207 MessageKind.COMPILER_CRASHED.error().toString(), | 211 MessageKind.COMPILER_CRASHED.error().toString(), |
| 208 api.Diagnostic.CRASH); | 212 api.Diagnostic.CRASH); |
| 209 // TODO(ahe): Obtain the build ID. | 213 // TODO(ahe): Obtain the build ID. |
| 210 var buildId = 'build number could not be determined'; | 214 var buildId = 'build number could not be determined'; |
| 211 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([buildId])); | 215 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([buildId])); |
| 212 } | 216 } |
| 213 | 217 |
| 214 void cancel([String reason, Node node, Token token, | 218 void cancel([String reason, Node node, Token token, |
| 215 HInstruction instruction, Element element]) { | 219 HInstruction instruction, Element element]) { |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 codegenWorld.addGeneratedCode(work, codeBuffer); | 762 codegenWorld.addGeneratedCode(work, codeBuffer); |
| 759 return codeBuffer.toString(); | 763 return codeBuffer.toString(); |
| 760 } | 764 } |
| 761 } | 765 } |
| 762 | 766 |
| 763 void registerInstantiatedClass(ClassElement cls) { | 767 void registerInstantiatedClass(ClassElement cls) { |
| 764 enqueuer.resolution.registerInstantiatedClass(cls); | 768 enqueuer.resolution.registerInstantiatedClass(cls); |
| 765 enqueuer.codegen.registerInstantiatedClass(cls); | 769 enqueuer.codegen.registerInstantiatedClass(cls); |
| 766 } | 770 } |
| 767 | 771 |
| 768 void resolveClass(ClassElement element) { | |
| 769 withCurrentElement(element, () => resolver.resolveClass(element)); | |
| 770 } | |
| 771 | |
| 772 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) { | 772 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) { |
| 773 return resolver.resolveTypeAnnotation(element, annotation); | 773 return resolver.resolveTypeAnnotation(element, annotation); |
| 774 } | 774 } |
| 775 | 775 |
| 776 FunctionSignature resolveSignature(FunctionElement element) { | 776 FunctionSignature resolveSignature(FunctionElement element) { |
| 777 return withCurrentElement(element, | 777 return withCurrentElement(element, |
| 778 () => resolver.resolveSignature(element)); | 778 () => resolver.resolveSignature(element)); |
| 779 } | 779 } |
| 780 | 780 |
| 781 FunctionSignature resolveFunctionExpression(Element element, | 781 FunctionSignature resolveFunctionExpression(Element element, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 final endOffset = end.charOffset + end.slowCharCount; | 948 final endOffset = end.charOffset + end.slowCharCount; |
| 949 | 949 |
| 950 // [begin] and [end] might be the same for the same empty token. This | 950 // [begin] and [end] might be the same for the same empty token. This |
| 951 // happens for instance when scanning '$$'. | 951 // happens for instance when scanning '$$'. |
| 952 assert(endOffset >= beginOffset); | 952 assert(endOffset >= beginOffset); |
| 953 return f(beginOffset, endOffset); | 953 return f(beginOffset, endOffset); |
| 954 } | 954 } |
| 955 | 955 |
| 956 String toString() => 'SourceSpan($uri, $begin, $end)'; | 956 String toString() => 'SourceSpan($uri, $begin, $end)'; |
| 957 } | 957 } |
| OLD | NEW |