1 19 20 package soot.javaToJimple; 21 import java.util.*; 22 23 public class TypeListBuilder extends polyglot.visit.NodeVisitor { 24 25 26 private HashSet list; 27 28 public HashSet getList() { 29 return list; 30 } 31 32 public TypeListBuilder(){ 33 list = new HashSet(); 34 } 35 36 public polyglot.ast.Node leave(polyglot.ast.Node old, polyglot.ast.Node n, polyglot.visit.NodeVisitor visitor) { 37 38 if (n instanceof polyglot.ast.Typed) { 39 polyglot.ast.Typed typedNode = (polyglot.ast.Typed)n; 40 if (typedNode.type() instanceof polyglot.types.ClassType) { 41 list.add(typedNode.type()); 42 } 43 else { 44 } 45 } 46 if (n instanceof polyglot.ast.ClassDecl){ 47 polyglot.ast.ClassDecl cd = (polyglot.ast.ClassDecl)n; 48 if (cd.type() instanceof polyglot.types.ClassType){ 49 list.add(cd.type()); 50 } 51 52 } 53 return n; 54 } 55 } 56 | Popular Tags |