How to use the @glimmer/syntax.builders.number function in @glimmer/syntax

To help you get started, we’ve selected a few @glimmer/syntax 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 linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructSwitch(stateExpr: Switch & HasGroup & HasAttrValue, rewrite: IndexedClassRewrite
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructDependency(stateExpr: Dependency, rewrite: IndexedClassRewrite
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
if (hasDependency(stateExpr)) {
        expr.push(builders.number(SourceExpression.switchWithDep));
        expr.push(...constructDependency(stateExpr, rewrite));
      } else {
        expr.push(builders.number(SourceExpression.switch));
      }
      expr.push(...constructSwitch(stateExpr, rewrite));
    } else {
      let type = 0;
      if (hasDependency(stateExpr)) {
        type = type | SourceExpression.dependency;
      }
      if (isConditional(stateExpr)) {
        type = type | SourceExpression.boolean;
      }
      expr.push(builders.number(type));
      if (hasDependency(stateExpr)) {
        expr.push(...constructDependency(stateExpr, rewrite));
      }
      if (isConditional(stateExpr)) {
        expr.push(...constructConditional(stateExpr, rewrite));
      }
      expr.push(...constructStateReferences(stateExpr, rewrite));
    }
  }
  return expr;
}
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructBoolean(bool: ConditionalArg): AST.Expression[] {
  if (typeof bool === "number") {
    return [builders.number(bool)];
  } else if (isAndExpression(bool)) {
    return constructAndExpression(bool);
  } else if (isOrExpression(bool)) {
    return constructOrExpression(bool);
  } else if (isNotExpression(bool)) {
    return constructNotExpression(bool);
  } else {
    assertNever(bool);
    return [builders.null()];
  }
}
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructConditionalExpression(type: BooleanExpr, args: Array): AST.Expression[] {
  let expr = new Array();
  if (args.length === 1) {
    let n = args[0];
    if (typeof n === "number") {
      expr.push(builders.number(n));
      return expr;
    }
  }
  expr.push(builders.number(type));
  expr.push(builders.number(args.length));
  for (let e of args) {
    if (typeof e === "number") {
      expr.push(builders.number(e));
    } else {
      expr.push(...constructBoolean(e));
    }
  }
  return expr;
}
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructConditionalExpression(type: BooleanExpr, args: Array): AST.Expression[] {
  let expr = new Array();
  if (args.length === 1) {
    let n = args[0];
    if (typeof n === "number") {
      expr.push(builders.number(n));
      return expr;
    }
  }
  expr.push(builders.number(type));
  expr.push(builders.number(args.length));
  for (let e of args) {
    if (typeof e === "number") {
      expr.push(builders.number(e));
    } else {
      expr.push(...constructBoolean(e));
    }
  }
  return expr;
}
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructArgs(rewrite: IndexedClassRewrite, element: TemplateElement): AST.Expression[] {
  let expr = new Array();
  expr.push(builders.number(element.dynamicClasses.length + element.dynamicAttributes.length));
  expr.push(builders.number(rewrite.dynamicClasses.length));
  expr.push(...constructSourceArgs(rewrite, element));
  expr.push(...constructOutputArgs(rewrite));
  return expr;
}
github linkedin / css-blocks / packages / @css-blocks / glimmer / src / ClassnamesHelperGenerator.ts View on Github external
function constructConditionalExpression(type: BooleanExpr, args: Array): AST.Expression[] {
  let expr = new Array();
  if (args.length === 1) {
    let n = args[0];
    if (typeof n === "number") {
      expr.push(builders.number(n));
      return expr;
    }
  }
  expr.push(builders.number(type));
  expr.push(builders.number(args.length));
  for (let e of args) {
    if (typeof e === "number") {
      expr.push(builders.number(e));
    } else {
      expr.push(...constructBoolean(e));
    }
  }
  return expr;
}