@@ -25,6 +25,8 @@ import 'file_system.dart' show FileSystem;
2525
2626import 'standard_file_system.dart' show StandardFileSystem;
2727
28+ import '../api_unstable/util.dart' ;
29+
2830export 'package:_fe_analyzer_shared/src/messages/diagnostic_message.dart'
2931 show DiagnosticMessage;
3032
@@ -102,7 +104,7 @@ class CompilerOptions {
102104 /// When this option is `true` , [sdkSummary] must be null.
103105 bool compileSdk = false ;
104106
105- @deprecated
107+ @Deprecated ( "Unused internally." )
106108 bool chaseDependencies;
107109
108110 /// Patch files to apply on the core libraries for a specific target platform.
@@ -119,6 +121,7 @@ class CompilerOptions {
119121 /// directly, while relative URIs are resolved from the [sdkRoot] .
120122 // TODO(sigmund): provide also a flag to load this data from a file (like
121123 // libraries.json)
124+ @Deprecated ("Unused internally." )
122125 Map <String , List <Uri >> targetPatches = < String , List <Uri >> {};
123126
124127 /// Enable or disable experimental features. Features mapping to `true` are
@@ -153,6 +156,7 @@ class CompilerOptions {
153156
154157 /// Deprecated. Has no affect on front-end.
155158 // TODO(dartbug.com/37514) Remove this field once DDK removes its uses of it.
159+ @Deprecated ("Unused internally." )
156160 bool enableAsserts = false ;
157161
158162 /// Whether to show verbose messages (mainly for debugging and performance
@@ -232,6 +236,65 @@ class CompilerOptions {
232236 String currentSdkVersion = "${kernel .defaultLanguageVersionMajor }"
233237 "."
234238 "${kernel .defaultLanguageVersionMinor }" ;
239+
240+ bool equivalent (CompilerOptions other,
241+ {bool ignoreOnDiagnostic: true ,
242+ bool ignoreVerbose: true ,
243+ bool ignoreVerify: true ,
244+ bool ignoreDebugDump: true }) {
245+ if (sdkRoot != other.sdkRoot) return false ;
246+ if (librariesSpecificationUri != other.librariesSpecificationUri) {
247+ return false ;
248+ }
249+ if (! ignoreOnDiagnostic) {
250+ if (onDiagnostic != other.onDiagnostic) return false ;
251+ }
252+ if (packagesFileUri != other.packagesFileUri) return false ;
253+ if (! equalLists (additionalDills, other.additionalDills)) return false ;
254+ if (sdkSummary != other.sdkSummary) return false ;
255+ if (! equalMaps (declaredVariables, other.declaredVariables)) return false ;
256+ if (fileSystem != other.fileSystem) return false ;
257+ if (compileSdk != compileSdk) return false ;
258+ // chaseDependencies aren't used anywhere, so ignored here.
259+ // targetPatches aren't used anywhere, so ignored here.
260+ if (! equalMaps (experimentalFlags, other.experimentalFlags)) return false ;
261+ if (! equalMaps (environmentDefines, other.environmentDefines)) return false ;
262+ if (errorOnUnevaluatedConstant != other.errorOnUnevaluatedConstant) {
263+ return false ;
264+ }
265+ if (target != other.target) {
266+ if (target.runtimeType != other.target.runtimeType) return false ;
267+ if (target.name != other.target.name) return false ;
268+ if (target.flags != other.target.flags) return false ;
269+ }
270+ // enableAsserts is not used anywhere, so ignored here.
271+ if (! ignoreVerbose) {
272+ if (verbose != other.verbose) return false ;
273+ }
274+ if (! ignoreVerify) {
275+ if (verify != other.verify) return false ;
276+ }
277+ if (! ignoreDebugDump) {
278+ if (debugDump != other.debugDump) return false ;
279+ }
280+ if (omitPlatform != other.omitPlatform) return false ;
281+ if (setExitCodeOnProblem != other.setExitCodeOnProblem) return false ;
282+ if (embedSourceText != other.embedSourceText) return false ;
283+ if (throwOnErrorsForDebugging != other.throwOnErrorsForDebugging) {
284+ return false ;
285+ }
286+ if (throwOnWarningsForDebugging != other.throwOnWarningsForDebugging) {
287+ return false ;
288+ }
289+ if (skipForDebugging != other.skipForDebugging) return false ;
290+ if (bytecode != other.bytecode) return false ;
291+ if (writeFileOnCrashReport != other.writeFileOnCrashReport) return false ;
292+ if (nnbdMode != other.nnbdMode) return false ;
293+ if (performNnbdChecks != other.performNnbdChecks) return false ;
294+ if (currentSdkVersion != other.currentSdkVersion) return false ;
295+
296+ return true ;
297+ }
235298}
236299
237300/// Parse experimental flag arguments of the form 'flag' or 'no-flag' into a map
0 commit comments