public Map < String , Declaration > getDeclarations ( RuleImpl rule , String consequenceName ) { Map < String , Declaration > declarations = new HashMap < String , Declaration > ( ) ; for ( RuleConditionElement aBuildStack : this . buildStack ) { // if we are inside of an OR we don't want each previous stack entry added because we can't see those variables if ( aBuildStack instanceof GroupElement && ( ( GroupElement ) aBuildStack ) . getType ( ) == GroupElement . Type . OR ) { continue ; } // this may be optimized in the future to only re-add elements at // scope breaks, like "NOT" and "EXISTS" Map < String , Declaration > innerDeclarations = aBuildStack instanceof GroupElement ? ( ( GroupElement ) aBuildStack ) . getInnerDeclarations ( consequenceName ) : aBuildStack . getInnerDeclarations ( ) ; declarations . putAll ( innerDeclarations ) ; } if ( null != rule . getParent ( ) ) { return getAllExtendedDeclaration ( rule . getParent ( ) , declarations ) ; } return declarations ; }
Return all declarations scoped to the current RuleConditionElement in the build stack