How to use the @glimmer/interfaces.CompileMode.aot function in @glimmer/interfaces

To help you get started, we’ve selected a few @glimmer/interfaces examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / packages / @glimmer / bundle-compiler / lib / bundle-compiler.ts View on Github external
export { CompilableTemplate };

export class BundleCompilerCompilationContext implements WholeProgramCompilationContext {
  readonly compilableTemplates = new ModuleLocatorMap();
  readonly compiledBlocks = new ModuleLocatorMap();
  readonly meta = new ModuleLocatorMap();

  // implement WholeProgramCompilationContext
  readonly constants: CompileTimeConstants;
  readonly resolverDelegate: BundleCompilerLookup = new BundleCompilerLookup(
    this.delegate,
    this.compilableTemplates,
    this.meta
  );
  readonly heap: CompileTimeHeap = new HeapImpl();
  readonly mode = CompileMode.aot;
  readonly stdlib: STDLib;

  constructor(
    readonly delegate: BundleCompilerDelegate,
    options: BundleCompilerOptions
  ) {
    if (options.constants) {
      this.constants = options.constants;
    } else {
      this.constants = new DebugConstants();
    }

    this.stdlib = compileStd(this);
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / syntax / push-compile.ts View on Github external
function invokeStatic(
  context: SyntaxCompilationContext,
  action: InvokeStaticOp
): StatementCompileActions {
  let compilable = action.op1;

  if (context.program.mode === CompileMode.aot) {
    let handle = compilable.compile(context);

    // If the handle for the invoked component is not yet known (for example,
    // because this is a recursive invocation and we're still compiling), push a
    // function that will produce the correct handle when the heap is
    // serialized.
    if (handle === PLACEHOLDER_HANDLE) {
      return op(MachineOp.InvokeStatic, () => compilable.compile(context));
    } else {
      return op(MachineOp.InvokeStatic, handle);
    }
  } else {
    return [op(Op.Constant, other(action.op1)), op(Op.CompileBlock), op(MachineOp.InvokeVirtual)];
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / context.ts View on Github external
export function Context(
  resolver: ResolverDelegate = {},
  mode: CompileMode = CompileMode.aot,
  macros = new MacrosImpl()
) {
  return {
    program: new ProgramCompilationContext(new DefaultCompileTimeResolverDelegate(resolver), mode),
    macros,
  };
}
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / context.ts View on Github external
export function AotContext(resolver: ResolverDelegate = {}, macros = new MacrosImpl()) {
  return {
    program: new ProgramCompilationContext(
      new DefaultCompileTimeResolverDelegate(resolver),
      CompileMode.aot
    ),
    macros,
  };
}