| 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 package com.google.dart.compiler.resolver; | 6 package com.google.dart.compiler.resolver; |
| 7 | 7 |
| 8 import com.google.common.base.Joiner; | 8 import com.google.common.base.Joiner; |
| 9 import com.google.common.collect.Lists; | 9 import com.google.common.collect.Lists; |
| 10 import com.google.dart.compiler.ast.DartClass; | 10 import com.google.dart.compiler.ast.DartClass; |
| 11 import com.google.dart.compiler.ast.DartIdentifier; | 11 import com.google.dart.compiler.ast.DartIdentifier; |
| 12 import com.google.dart.compiler.ast.DartNode; | 12 import com.google.dart.compiler.ast.DartNode; |
| 13 import com.google.dart.compiler.ast.DartNodeTraverser; | 13 import com.google.dart.compiler.ast.ASTVisitor; |
| 14 import com.google.dart.compiler.ast.DartParameterizedTypeNode; | 14 import com.google.dart.compiler.ast.DartParameterizedTypeNode; |
| 15 import com.google.dart.compiler.ast.DartTypeNode; | 15 import com.google.dart.compiler.ast.DartTypeNode; |
| 16 import com.google.dart.compiler.ast.DartTypeParameter; | 16 import com.google.dart.compiler.ast.DartTypeParameter; |
| 17 | 17 |
| 18 import java.util.List; | 18 import java.util.List; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Look for DartIdentifier nodes in the tree whose symbols are null. They shou
ld all either | 21 * Look for DartIdentifier nodes in the tree whose symbols are null. They shou
ld all either |
| 22 * be resolved, or marked as an unresolved element. | 22 * be resolved, or marked as an unresolved element. |
| 23 */ | 23 */ |
| 24 public class ResolverAuditVisitor extends DartNodeTraverser<Void> { | 24 public class ResolverAuditVisitor extends ASTVisitor<Void> { |
| 25 public static void exec(DartNode root) { | 25 public static void exec(DartNode root) { |
| 26 ResolverAuditVisitor visitor = new ResolverAuditVisitor(); | 26 ResolverAuditVisitor visitor = new ResolverAuditVisitor(); |
| 27 root.accept(visitor); | 27 root.accept(visitor); |
| 28 List<String> results = visitor.getFailures(); | 28 List<String> results = visitor.getFailures(); |
| 29 if (results.size() > 0) { | 29 if (results.size() > 0) { |
| 30 StringBuilder out = new StringBuilder("Missing symbols found in AST\n"); | 30 StringBuilder out = new StringBuilder("Missing symbols found in AST\n"); |
| 31 Joiner.on("\n").appendTo(out, results); | 31 Joiner.on("\n").appendTo(out, results); |
| 32 ResolverTestCase.fail(out.toString()); | 32 ResolverTestCase.fail(out.toString()); |
| 33 } | 33 } |
| 34 } | 34 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 @Override | 72 @Override |
| 73 public Void visitTypeParameter(DartTypeParameter node) { | 73 public Void visitTypeParameter(DartTypeParameter node) { |
| 74 node.getName().accept(this); | 74 node.getName().accept(this); |
| 75 if (node.getBound() != null) { | 75 if (node.getBound() != null) { |
| 76 node.getBound().accept(this); | 76 node.getBound().accept(this); |
| 77 } | 77 } |
| 78 return null; | 78 return null; |
| 79 } | 79 } |
| 80 } | 80 } |
| OLD | NEW |