Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function JitDelegateContext(
doc: SimpleDocument,
resolver: TestJitRuntimeResolver,
registry: TestJitRegistry
): JitTestDelegateContext {
registerInternalHelper(registry, '-get-dynamic-var', getDynamicVar);
let context = new TestJitCompilationContext(resolver, registry);
let runtime = JitRuntimeFromProgram(doc, context.program(), resolver);
let syntax = { program: context, macros: new TestMacros() };
return { runtime, syntax };
}
export function JitTestContext(delegate: RuntimeEnvironmentDelegate = {}): TestContext {
let resolver = new TestJitRuntimeResolver();
let registry = resolver.registry;
registerHelper(registry, 'hash', (_positional, named) => named);
let context = new TestJitCompilationContext(resolver, registry);
let syntax: SyntaxCompilationContext = { program: context, macros: new TestMacros() };
let doc = document as SimpleDocument;
let runtime = JitRuntimeFromProgram(
document as SimpleDocument,
context.program(),
resolver,
assign(
{
toBool: emberToBool,
},
delegate
)
);
let root = document.getElementById('qunit-fixture')! as SimpleElement;
return { resolver, registry, program: context, syntax, doc, root, runtime, env: runtime.env };
}