private TypedScope getScopeDeclaredIn ( ) { if ( declarationScope != null ) { return declarationScope ; } int dotIndex = fnName . indexOf ( ' ' ) ; if ( dotIndex != - 1 ) { String rootVarName = fnName . substring ( 0 , dotIndex ) ; TypedVar rootVar = enclosingScope . getVar ( rootVarName ) ; if ( rootVar != null ) { return rootVar . getScope ( ) ; } } return enclosingScope ; }
The scope that we should declare this function in if it needs to be declared in a scope . Notice that TypedScopeCreator takes care of most scope - declaring .