CompileContext.forTesting constructor

  1. @visibleForTesting
const CompileContext.forTesting({
  1. bool isDevToolsEnabled,
  2. 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 isDevToolsEnabled,
  bool validateMissingDirectives,
}) = _TestCompileContext;