private Node tryFoldAddConstantString ( Node n , Node left , Node right ) { if ( left . isString ( ) || right . isString ( ) || left . isArrayLit ( ) || right . isArrayLit ( ) ) { // Add strings. String leftString = NodeUtil . getStringValue ( left ) ; String rightString = NodeUtil . getStringValue ( right ) ; if ( leftString != null && rightString != null ) { Node newStringNode = IR . string ( leftString + rightString ) ; n . replaceWith ( newStringNode ) ; reportChangeToEnclosingScope ( newStringNode ) ; return newStringNode ; } } return n ; }
Try to fold an ADD node with constant operands