| 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 library mock_compiler; | 5 library mock_compiler; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 | 10 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 TreeElementMapping resolveNodeStatement(Node tree, | 206 TreeElementMapping resolveNodeStatement(Node tree, |
| 207 ExecutableElement element) { | 207 ExecutableElement element) { |
| 208 ResolverVisitor visitor = | 208 ResolverVisitor visitor = |
| 209 new ResolverVisitor(this, element, | 209 new ResolverVisitor(this, element, |
| 210 new ResolutionRegistry.internal(this, | 210 new ResolutionRegistry.internal(this, |
| 211 new CollectingTreeElements(element))); | 211 new CollectingTreeElements(element))); |
| 212 if (visitor.scope is LibraryScope) { | 212 if (visitor.scope is LibraryScope) { |
| 213 visitor.scope = new MethodScope(visitor.scope, element); | 213 visitor.scope = new MethodScope(visitor.scope, element); |
| 214 } | 214 } |
| 215 try { | 215 visitor.visit(tree); |
| 216 visitor.visit(tree); | |
| 217 } on CompilerCancelledException catch (_) { | |
| 218 // Ignored. | |
| 219 | |
| 220 // TODO(ahe): Don't ignore CompilerCancelledException, instead, fix | |
| 221 // pkg/compiler/lib/src/resolution/members.dart. | |
| 222 } | |
| 223 visitor.scope = new LibraryScope(element.library); | 216 visitor.scope = new LibraryScope(element.library); |
| 224 return visitor.registry.mapping; | 217 return visitor.registry.mapping; |
| 225 } | 218 } |
| 226 | 219 |
| 227 resolverVisitor() { | 220 resolverVisitor() { |
| 228 Element mockElement = new MockElement(mainApp.entryCompilationUnit); | 221 Element mockElement = new MockElement(mainApp.entryCompilationUnit); |
| 229 ResolverVisitor visitor = | 222 ResolverVisitor visitor = |
| 230 new ResolverVisitor(this, mockElement, | 223 new ResolverVisitor(this, mockElement, |
| 231 new ResolutionRegistry.internal(this, | 224 new ResolutionRegistry.internal(this, |
| 232 new CollectingTreeElements(mockElement))); | 225 new CollectingTreeElements(mockElement))); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 MockElement(Element enclosingElement) | 389 MockElement(Element enclosingElement) |
| 397 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 390 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
| 398 enclosingElement, false); | 391 enclosingElement, false); |
| 399 | 392 |
| 400 get node => null; | 393 get node => null; |
| 401 | 394 |
| 402 parseNode(_) => null; | 395 parseNode(_) => null; |
| 403 | 396 |
| 404 bool get hasNode => false; | 397 bool get hasNode => false; |
| 405 } | 398 } |
| OLD | NEW |