private void updateSideEffectsForExternFunction(
        Node externFunction, AmbiguatedFunctionSummary summary) {
      checkArgument(externFunction.isFunction());
      checkArgument(externFunction.isFromExterns());

      JSDocInfo info = NodeUtil.getBestJSDocInfo(externFunction);
      // Handle externs.
      JSType typei = externFunction.getJSType();
      FunctionType functionType = typei == null ? null : typei.toMaybeFunctionType();
      if (functionType == null) {
        // Assume extern functions return tainted values when we have no type info to say otherwise.
        summary.setEscapedReturn();
      } else {
        JSType retType = functionType.getReturnType();
        if (!isLocalValueType(retType, compiler)) {
          summary.setEscapedReturn();
        }
      }

      if (info == null) {
        // We don't know anything about this function so we assume it has side effects.
        summary.setMutatesGlobalState();
        summary.setFunctionThrows();
      } else {
        if (info.modifiesThis()) {
          summary.setMutatesThis();
        } else if (info.hasSideEffectsArgumentsAnnotation()) {
          summary.setMutatesArguments();
        } else if (!info.getThrownTypes().isEmpty()) {
          summary.setFunctionThrows();
        } else if (info.isNoSideEffects()) {
          // Do nothing.
        } else {
          summary.setMutatesGlobalState();
        }
      }
    }
private void updateSideEffectsForExternFunction ( Node externFunction , AmbiguatedFunctionSummary summary ) { checkArgument ( externFunction . isFunction ( ) ) ; checkArgument ( externFunction . isFromExterns ( ) ) ; JSDocInfo info = NodeUtil . getBestJSDocInfo ( externFunction ) ; JSType typei = externFunction . getJSType ( ) ; FunctionType functionType = typei == null ? null : typei . toMaybeFunctionType ( ) ; if ( functionType == null ) { summary . setEscapedReturn ( ) ; } else { JSType retType = functionType . getReturnType ( ) ; if ( ! isLocalValueType ( retType , compiler ) ) { summary . setEscapedReturn ( ) ; } } if ( info == null ) { summary . setMutatesGlobalState ( ) ; summary . setFunctionThrows ( ) ; } else { if ( info . modifiesThis ( ) ) { summary . setMutatesThis ( ) ; } else if ( info . hasSideEffectsArgumentsAnnotation ( ) ) { summary . setMutatesArguments ( ) ; } else if ( ! info . getThrownTypes ( ) . isEmpty ( ) ) { summary . setFunctionThrows ( ) ; } else if ( info . isNoSideEffects ( ) ) { } else { summary . setMutatesGlobalState ( ) ; } } }
Update function for @nosideeffects annotations.