private static Expression buildAccessChain ( Expression base , CodeChunk . Generator generator , Iterator < ChainAccess > chain ) { if ( ! chain . hasNext ( ) ) { return base ; // base case } ChainAccess link = chain . next ( ) ; if ( link . nullSafe ) { if ( ! base . isCheap ( ) ) { base = generator . declarationBuilder ( ) . setRhs ( base ) . build ( ) . ref ( ) ; } return ifExpression ( base . doubleEqualsNull ( ) , LITERAL_NULL ) . setElse ( buildAccessChain ( link . extend ( base ) , generator , chain ) ) . build ( generator ) ; } return buildAccessChain ( link . extend ( base ) , generator , chain ) ; }
Builds the access chain .