A stylesheet language written in TypeScript that compiles to CSS
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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. }