How to use the @glimmer/util.unreachable function in @glimmer/util

To help you get started, we’ve selected a few @glimmer/util 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 / runtime / lib / vm / stack.ts View on Github external
function encodeImmediate(primitive: number | boolean | null | undefined): number {
  switch (typeof primitive) {
    case 'number':
      return encodeSmi(primitive as number);
    case 'boolean':
      return primitive ? Immediates.True : Immediates.False;
    case 'object':
      // assume null
      return Immediates.Null;
    case 'undefined':
      return Immediates.Undef;
    default:
      throw unreachable();
  }
}
github bakerac4 / glimmer-native / dist / src / glimmer / resolver.js View on Github external
lookupPartial(name, referrer) {
        throw unreachable();
    }
    registerComponent(name, ComponentClass) {
github bakerac4 / glimmer-native / src / glimmer / resolver.ts View on Github external
lookupPartial(name: string, referrer: TemplateMeta): number {
        throw unreachable();
    }
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / vm / stack.ts View on Github external
function decodeSmi(smi: number): number {
  switch (smi & 0b111) {
    case PrimitiveType.NUMBER:
      return smi >> 3;
    case PrimitiveType.NEGATIVE:
      return -(smi >> 3);
    default:
      throw unreachable();
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / hbs / combine-content.ts View on Github external
if (right === undefined) {
    if (left.type === 'Newline') {
      value = '\n';
    } else {
      value = left.value;
    }
  } else if (left.type === 'Newline' && right.type === 'Newline') {
    value = '\n\n';
  } else if (left.type === 'Newline' && right.type === 'TextNode') {
    value = `\n${right.value}`;
  } else if (left.type === 'TextNode' && right.type === 'Newline') {
    value = `${left.value}\n`;
  } else if (left.type === 'TextNode' && right.type === 'TextNode') {
    value = `${left.value}${right.value}`;
  } else {
    throw unreachable();
  }

  return {
    type: 'TextNode',
    span,
    value,
  };
}