CompileContext.forTesting constructor

  1. @visibleForTesting
const CompileContext.forTesting({
  1. bool emitNullSafeCode,
  2. bool isDevToolsEnabled,
  3. bool validateMissingDirectives,
})

Creates a standalone CompileContext with pre-configured flags.

This is intended for use with overrideForTesting only:

// Generate null-safe code in these test cases.
CompileContext.overrideForTesting(CompileContext.forTesting(
  emitNullSafeCode: true,
))

NOTE: reportAndRecover simply uses throw in this configuration.

Implementation

@visibleForTesting
const factory CompileContext.forTesting({
  bool emitNullSafeCode,
  bool isDevToolsEnabled,
  bool validateMissingDirectives,
}) = _TestCompileContext;