static boolean nodeTypeMayHaveSideEffects ( Node n , AbstractCompiler compiler ) { if ( isAssignmentOp ( n ) ) { return true ; } switch ( n . getToken ( ) ) { case DELPROP : case DEC : case INC : case YIELD : case THROW : case AWAIT : case FOR_IN : // assigns to a loop LHS case FOR_OF : // assigns to a loop LHS, runs an iterator case FOR_AWAIT_OF : // assigns to a loop LHS, runs an iterator, async operations. return true ; case CALL : case TAGGED_TEMPLATELIT : return NodeUtil . functionCallHasSideEffects ( n , compiler ) ; case NEW : return NodeUtil . constructorCallHasSideEffects ( n ) ; case NAME : // A variable definition. // TODO(b/129564961): Consider EXPORT declarations. return n . hasChildren ( ) ; case REST : case SPREAD : return NodeUtil . iteratesImpureIterable ( n ) ; default : break ; } return false ; }
Returns true if the current node s type implies side effects .