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.

application.ts 653B

123456789101112131415161718192021
  1. import * as AST from '../ast';
  2. import Env, { EnvError } from '../env';
  3. export class Application {
  4. public name: AST.Literal;
  5. public arguments: AST.Node[];
  6. public constructor(name: AST.Literal, args: AST.Node[]) {
  7. this.name = name;
  8. this.arguments = args;
  9. }
  10. public compile(env: Env, opts: AST.Opts): string | EnvError {
  11. const wordSpacer = opts.prettyPrint ? ' ' : '';
  12. const [lParen, rParen, comma] = ['(', ')', ','];
  13. const compiledArguments = this.arguments
  14. .map((arg) => arg.compile(env, opts))
  15. .join(`${comma}${wordSpacer}`);
  16. return `${this.name.value.value}${lParen}${compiledArguments}${rParen}`;
  17. }
  18. }