3
using System.Collections;
5
using ICSharpCode.SharpRefactory.Parser.AST.VB;
7
namespace ICSharpCode.SharpRefactory.Parser.VB
9
public class LocalLookupVariable
11
TypeReference typeRef;
15
public TypeReference TypeRef {
20
public Point StartPos {
31
public LocalLookupVariable(TypeReference typeRef, Point startPos, Point endPos)
33
this.typeRef = typeRef;
34
this.startPos = startPos;
39
public class LookupTableVisitor : AbstractASTVisitor
41
Hashtable variables = new Hashtable();
42
ArrayList withStatements = new ArrayList();
44
public Hashtable Variables {
50
public ArrayList WithStatements {
52
return withStatements;
56
public void AddVariable(TypeReference typeRef, string name, Point startPos, Point endPos)
58
if (name == null || name.Length == 0) {
61
name = name.ToLower();
63
if (variables[name] == null) {
64
variables[name] = list = new ArrayList();
66
list = (ArrayList)variables[name];
68
list.Add(new LocalLookupVariable(typeRef, startPos, endPos));
71
public override object Visit(LocalVariableDeclaration localVariableDeclaration, object data)
73
foreach (VariableDeclaration varDecl in localVariableDeclaration.Variables) {
74
AddVariable(varDecl.Type,
76
localVariableDeclaration.StartLocation,
77
CurrentBlock == null ? new Point(-1, -1) : CurrentBlock.EndLocation);
82
public override object Visit(LoopControlVariableExpression loopControlVariableExpression, object data)
84
AddVariable(loopControlVariableExpression.Type,
85
loopControlVariableExpression.Name,
86
loopControlVariableExpression.StartLocation,
87
CurrentBlock == null ? new Point(-1, -1) : CurrentBlock.EndLocation);
91
public override object Visit(WithStatement withStatement, object data)
93
withStatements.Add(withStatement);
94
return base.Visit(withStatement, data);