A stylesheet language written in TypeScript that compiles to CSS
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

let.ts 749B

123456789101112131415161718192021222324
  1. import * as AST from '../ast';
  2. import Env, { EnvError } from '../env';
  3. export class Let {
  4. public bindings: AST.Binding[];
  5. public children: AST.Node[];
  6. public constructor(bindings: AST.Binding[], children: AST.Node[]) {
  7. this.bindings = bindings;
  8. this.children = children;
  9. }
  10. public compile(env: Env, opts: AST.Opts): string | EnvError {
  11. this.bindings.forEach((binding) => {
  12. env.set(binding.identifier.name.value, binding.value);
  13. });
  14. const children = this.children.map((child) => child.compile(env, opts));
  15. const childrenError = children.find((node) => node instanceof EnvError);
  16. if (childrenError instanceof EnvError) return childrenError;
  17. return children.join(opts.prettyPrint ? '\n' : '');
  18. }
  19. }