1 2 29 package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify; 30 31 32 33 34 public class DefaultScope extends Scope { 35 public DefaultScope(String name, Scope parentScope, SymTabAST node) { 36 super(name, parentScope, node); 37 } 38 39 public void addDefinition(IPackage def) { 40 throw new UnsupportedOperationException (getClass().getName()); 41 } 42 43 public IClass getClassDefinition( String name ) { 44 IClass result = (ClassDef)classes.get(name); 45 46 if ( result == null && getParentScope() != null ) { 47 result = getParentScope().getClassDefinition( name ); 48 } 49 50 return result; 51 } 52 53 public IMethod getMethodDefinition(String name, 54 ISignature signature) { 55 IMethod result = null; 56 if (getParentScope() != null) { 57 result = getParentScope().getMethodDefinition(name, signature); 58 } 59 60 return result; 61 } 62 63 public IVariable getVariableDefinition( String name ) { 64 IVariable result = (VariableDef)elements.get(name); 65 66 if ( result == null && getParentScope() != null ) { 67 result = getParentScope().getVariableDefinition( name ); 68 } 69 70 return result; 71 } 72 73 public LabelDef getLabelDefinition(String name) { 74 LabelDef result = (LabelDef)labels.get(name); 75 76 if (result == null && getParentScope() != null) { 77 result = getParentScope().getLabelDefinition(name); 78 } 79 80 return result; 81 } 82 } 83 | Popular Tags |