protected void reconcileOptionsWithGuards ( ) { // DiagnosticGroups override the plain checkTypes option. if ( options . enables ( DiagnosticGroups . CHECK_TYPES ) ) { options . checkTypes = true ; } else if ( options . disables ( DiagnosticGroups . CHECK_TYPES ) ) { options . checkTypes = false ; } else if ( ! options . checkTypes ) { // If DiagnosticGroups did not override the plain checkTypes // option, and checkTypes is disabled, then turn off the // parser type warnings. options . setWarningLevel ( DiagnosticGroup . forType ( RhinoErrorReporter . TYPE_PARSE_ERROR ) , CheckLevel . OFF ) ; } if ( options . checkGlobalThisLevel . isOn ( ) && ! options . disables ( DiagnosticGroups . GLOBAL_THIS ) ) { options . setWarningLevel ( DiagnosticGroups . GLOBAL_THIS , options . checkGlobalThisLevel ) ; } if ( options . expectStrictModeInput ( ) ) { options . setWarningLevel ( DiagnosticGroups . ES5_STRICT , CheckLevel . ERROR ) ; } // All passes must run the variable check. This synthesizes // variables later so that the compiler doesn't crash. It also // checks the externs file for validity. If you don't want to warn // about missing variable declarations, we shut that specific // error off. if ( ! options . checkSymbols && ! options . enables ( DiagnosticGroups . CHECK_VARIABLES ) ) { options . setWarningLevel ( DiagnosticGroups . CHECK_VARIABLES , CheckLevel . OFF ) ; } // If we're in transpile-only mode, we don't need to do checks for suspicious var usages. // Since we still have to run VariableReferenceCheck before transpilation to check block-scoped // variables, though, we disable the unnecessary warnings it produces relating to vars here. if ( options . skipNonTranspilationPasses && ! options . enables ( DiagnosticGroups . CHECK_VARIABLES ) ) { options . setWarningLevel ( DiagnosticGroups . CHECK_VARIABLES , CheckLevel . OFF ) ; } // If we're in transpile-only mode, we don't need to check for missing requires unless the user // explicitly enables missing-provide checks. if ( options . skipNonTranspilationPasses && ! options . enables ( DiagnosticGroups . MISSING_PROVIDE ) ) { options . setWarningLevel ( DiagnosticGroups . MISSING_PROVIDE , CheckLevel . OFF ) ; } if ( options . brokenClosureRequiresLevel == CheckLevel . OFF ) { options . setWarningLevel ( DiagnosticGroups . MISSING_PROVIDE , CheckLevel . OFF ) ; } }
When the CompilerOptions and its WarningsGuard overlap reconcile any discrepancies .