private void visitLhsNodes ( AmbiguatedFunctionSummary sideEffectInfo , Scope scope , Node enclosingFunction , List < Node > lhsNodes , Predicate < Node > hasLocalRhs ) { for ( Node lhs : lhsNodes ) { if ( NodeUtil . isGet ( lhs ) ) { if ( lhs . getFirstChild ( ) . isThis ( ) ) { sideEffectInfo . setMutatesThis ( ) ; } else { Node objectNode = lhs . getFirstChild ( ) ; if ( objectNode . isName ( ) ) { Var var = scope . getVar ( objectNode . getString ( ) ) ; if ( isVarDeclaredInSameContainerScope ( var , scope ) ) { // Maybe a local object modification. We won't know for sure until // we exit the scope and can validate the value of the local. taintedVarsByFunction . put ( enclosingFunction , var ) ; } else { sideEffectInfo . setMutatesGlobalState ( ) ; } } else { // Don't track multi level locals: local.prop.prop2++; sideEffectInfo . setMutatesGlobalState ( ) ; } } } else { checkState ( lhs . isName ( ) , lhs ) ; Var var = scope . getVar ( lhs . getString ( ) ) ; if ( isVarDeclaredInSameContainerScope ( var , scope ) ) { if ( ! hasLocalRhs . test ( lhs ) ) { // Assigned value is not guaranteed to be a local value, // so if we see any property assignments on this variable, // they could be tainting a non-local value. blacklistedVarsByFunction . put ( enclosingFunction , var ) ; } } else { sideEffectInfo . setMutatesGlobalState ( ) ; } } } }
Record information about the side effects caused by assigning a value to a given LHS .