public static List < Expression > getVariableExpressions ( DeclarationExpression declarationExpression ) { Expression leftExpression = declarationExpression . getLeftExpression ( ) ; // !important: performance enhancement if ( leftExpression instanceof ArrayExpression ) { List < Expression > expressions = ( ( ArrayExpression ) leftExpression ) . getExpressions ( ) ; return expressions . isEmpty ( ) ? Arrays . asList ( leftExpression ) : expressions ; } else if ( leftExpression instanceof ListExpression ) { List < Expression > expressions = ( ( ListExpression ) leftExpression ) . getExpressions ( ) ; return expressions . isEmpty ( ) ? Arrays . asList ( leftExpression ) : expressions ; } else if ( leftExpression instanceof TupleExpression ) { List < Expression > expressions = ( ( TupleExpression ) leftExpression ) . getExpressions ( ) ; return expressions . isEmpty ( ) ? Arrays . asList ( leftExpression ) : expressions ; } else if ( leftExpression instanceof VariableExpression ) { return Arrays . asList ( leftExpression ) ; } // todo: write warning return Collections . emptyList ( ) ; }
Return the List of VariableExpression objects referenced by the specified DeclarationExpression .