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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 static final int PHASE_RECOMPILING = 3; | 147 static final int PHASE_RECOMPILING = 3; |
148 int phase; | 148 int phase; |
149 | 149 |
150 bool compilationFailed = false; | 150 bool compilationFailed = false; |
151 | 151 |
152 bool hasCrashed = false; | 152 bool hasCrashed = false; |
153 | 153 |
154 Compiler([this.tracer = const Tracer(), | 154 Compiler([this.tracer = const Tracer(), |
155 this.enableTypeAssertions = false, | 155 this.enableTypeAssertions = false, |
156 this.enableUserAssertions = false, | 156 this.enableUserAssertions = false, |
157 bool emitJavascript = true, | 157 bool emitJavaScript = true, |
158 validateUnparse = false, | 158 validateUnparse = false, |
159 generateSourceMap = true]) | 159 generateSourceMap = true]) |
160 : libraries = new Map<String, LibraryElement>(), | 160 : libraries = new Map<String, LibraryElement>(), |
161 world = new World(), | 161 world = new World(), |
162 progress = new Stopwatch.start() { | 162 progress = new Stopwatch.start() { |
163 namer = new Namer(this); | 163 namer = new Namer(this); |
164 constantHandler = new ConstantHandler(this); | 164 constantHandler = |
| 165 new ConstantHandler(this, |
| 166 emitJavaScript |
| 167 ? const JavaScriptFoldingOperations() |
| 168 : const DartFoldingOperations()); |
165 scanner = new ScannerTask(this); | 169 scanner = new ScannerTask(this); |
166 dietParser = new DietParserTask(this); | 170 dietParser = new DietParserTask(this); |
167 parser = new ParserTask(this); | 171 parser = new ParserTask(this); |
168 patchParser = new PatchParserTask(this); | 172 patchParser = new PatchParserTask(this); |
169 validator = new TreeValidatorTask(this); | 173 validator = new TreeValidatorTask(this); |
170 resolver = new ResolverTask(this); | 174 resolver = new ResolverTask(this); |
171 closureToClassMapper = new closureMapping.ClosureTask(this); | 175 closureToClassMapper = new closureMapping.ClosureTask(this); |
172 checker = new TypeCheckerTask(this); | 176 checker = new TypeCheckerTask(this); |
173 typesTask = new ti.TypesTask(this); | 177 typesTask = new ti.TypesTask(this); |
174 backend = emitJavascript ? | 178 backend = emitJavaScript ? |
175 new js_backend.JavaScriptBackend(this, generateSourceMap) : | 179 new js_backend.JavaScriptBackend(this, generateSourceMap) : |
176 new dart_backend.DartBackend(this, validateUnparse); | 180 new dart_backend.DartBackend(this, validateUnparse); |
177 enqueuer = new EnqueueTask(this); | 181 enqueuer = new EnqueueTask(this); |
178 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, | 182 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, |
179 checker, typesTask, constantHandler, enqueuer]; | 183 checker, typesTask, constantHandler, enqueuer]; |
180 tasks.addAll(backend.tasks); | 184 tasks.addAll(backend.tasks); |
181 } | 185 } |
182 | 186 |
183 Universe get resolverWorld() => enqueuer.resolution.universe; | 187 Universe get resolverWorld() => enqueuer.resolution.universe; |
184 Universe get codegenWorld() => enqueuer.codegen.universe; | 188 Universe get codegenWorld() => enqueuer.codegen.universe; |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 final endOffset = end.charOffset + end.slowCharCount; | 947 final endOffset = end.charOffset + end.slowCharCount; |
944 | 948 |
945 // [begin] and [end] might be the same for the same empty token. This | 949 // [begin] and [end] might be the same for the same empty token. This |
946 // happens for instance when scanning '$$'. | 950 // happens for instance when scanning '$$'. |
947 assert(endOffset >= beginOffset); | 951 assert(endOffset >= beginOffset); |
948 return f(beginOffset, endOffset); | 952 return f(beginOffset, endOffset); |
949 } | 953 } |
950 | 954 |
951 String toString() => 'SourceSpan($uri, $begin, $end)'; | 955 String toString() => 'SourceSpan($uri, $begin, $end)'; |
952 } | 956 } |
OLD | NEW |