UI for Zipcoin Blue

convert-ast.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var ts = require("typescript");
  4. var util_1 = require("./util");
  5. function convertAst(sourceFile) {
  6. var wrapped = {
  7. node: sourceFile,
  8. parent: undefined,
  9. kind: ts.SyntaxKind.SourceFile,
  10. children: [],
  11. next: undefined,
  12. skip: undefined,
  13. };
  14. var flat = [];
  15. var current = wrapped;
  16. var previous = current;
  17. ts.forEachChild(sourceFile, function wrap(node) {
  18. flat.push(node);
  19. var parent = current;
  20. previous.next = current = {
  21. node: node,
  22. parent: parent,
  23. kind: node.kind,
  24. children: [],
  25. next: undefined,
  26. skip: undefined,
  27. };
  28. if (previous !== parent)
  29. setSkip(previous, current);
  30. previous = current;
  31. parent.children.push(current);
  32. if (util_1.isNodeKind(node.kind))
  33. ts.forEachChild(node, wrap);
  34. current = parent;
  35. });
  36. return {
  37. wrapped: wrapped,
  38. flat: flat,
  39. };
  40. }
  41. exports.convertAst = convertAst;
  42. function setSkip(node, skip) {
  43. do {
  44. node.skip = skip;
  45. node = node.parent;
  46. } while (node !== skip.parent);
  47. }
  48. //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydC1hc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJjb252ZXJ0LWFzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUFpQztBQUNqQywrQkFBb0M7QUFtQ3BDLG9CQUEyQixVQUF5QjtJQUNoRCxJQUFNLE9BQU8sR0FBZTtRQUN4QixJQUFJLEVBQUUsVUFBVTtRQUNoQixNQUFNLEVBQUUsU0FBUztRQUNqQixJQUFJLEVBQUUsRUFBRSxDQUFDLFVBQVUsQ0FBQyxVQUFVO1FBQzlCLFFBQVEsRUFBRSxFQUFFO1FBQ1osSUFBSSxFQUFPLFNBQVM7UUFDcEI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