OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; |
7 import com.google.dart.compiler.DartCompilerContext; | 8 import com.google.dart.compiler.DartCompilerContext; |
8 import com.google.dart.compiler.ErrorCode; | 9 import com.google.dart.compiler.ErrorCode; |
9 import com.google.dart.compiler.ast.DartClass; | 10 import com.google.dart.compiler.ast.DartClass; |
10 import com.google.dart.compiler.ast.DartExpression; | 11 import com.google.dart.compiler.ast.DartExpression; |
11 import com.google.dart.compiler.ast.DartField; | 12 import com.google.dart.compiler.ast.DartField; |
12 import com.google.dart.compiler.ast.DartFieldDefinition; | 13 import com.google.dart.compiler.ast.DartFieldDefinition; |
13 import com.google.dart.compiler.ast.DartFunctionTypeAlias; | 14 import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
14 import com.google.dart.compiler.ast.DartIdentifier; | 15 import com.google.dart.compiler.ast.DartIdentifier; |
15 import com.google.dart.compiler.ast.DartMethodDefinition; | 16 import com.google.dart.compiler.ast.DartMethodDefinition; |
16 import com.google.dart.compiler.ast.DartNode; | 17 import com.google.dart.compiler.ast.DartNode; |
(...skipping 15 matching lines...) Expand all Loading... |
32 */ | 33 */ |
33 public class MemberBuilder { | 34 public class MemberBuilder { |
34 private ResolutionContext topLevelContext; | 35 private ResolutionContext topLevelContext; |
35 private LibraryElement libraryElement; | 36 private LibraryElement libraryElement; |
36 | 37 |
37 public void exec(DartUnit unit, DartCompilerContext context, CoreTypeProvider
typeProvider) { | 38 public void exec(DartUnit unit, DartCompilerContext context, CoreTypeProvider
typeProvider) { |
38 libraryElement = unit.getLibrary().getElement(); | 39 libraryElement = unit.getLibrary().getElement(); |
39 exec(unit, context, libraryElement.getScope(), typeProvider); | 40 exec(unit, context, libraryElement.getScope(), typeProvider); |
40 } | 41 } |
41 | 42 |
| 43 @VisibleForTesting |
42 public void exec(DartUnit unit, DartCompilerContext compilerContext, Scope sco
pe, | 44 public void exec(DartUnit unit, DartCompilerContext compilerContext, Scope sco
pe, |
43 CoreTypeProvider typeProvider) { | 45 CoreTypeProvider typeProvider) { |
44 topLevelContext = new ResolutionContext(scope, compilerContext, typeProvider
); | 46 topLevelContext = new ResolutionContext(scope, compilerContext, typeProvider
); |
45 unit.accept(new MemberElementBuilder(typeProvider)); | 47 unit.accept(new MemberElementBuilder(typeProvider)); |
46 } | 48 } |
47 | 49 |
48 /** | 50 /** |
49 * Creates elements for the fields, methods and constructors of a class. The | 51 * Creates elements for the fields, methods and constructors of a class. The |
50 * elements are added to the ClassElement. | 52 * elements are added to the ClassElement. |
51 * | 53 * |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 506 } |
505 } | 507 } |
506 return element; | 508 return element; |
507 } | 509 } |
508 | 510 |
509 void resolutionError(DartNode node, ErrorCode errorCode, Object... arguments
) { | 511 void resolutionError(DartNode node, ErrorCode errorCode, Object... arguments
) { |
510 topLevelContext.onError(node, errorCode, arguments); | 512 topLevelContext.onError(node, errorCode, arguments); |
511 } | 513 } |
512 } | 514 } |
513 } | 515 } |
OLD | NEW |