Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

classes.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration;
  6. exports.ClassBody = ClassBody;
  7. exports.ClassProperty = ClassProperty;
  8. exports.ClassPrivateProperty = ClassPrivateProperty;
  9. exports.ClassMethod = ClassMethod;
  10. exports.ClassPrivateMethod = ClassPrivateMethod;
  11. exports._classMethodHead = _classMethodHead;
  12. exports.StaticBlock = StaticBlock;
  13. var t = require("@babel/types");
  14. function ClassDeclaration(node, parent) {
  15. if (!this.format.decoratorsBeforeExport || !t.isExportDefaultDeclaration(parent) && !t.isExportNamedDeclaration(parent)) {
  16. this.printJoin(node.decorators, node);
  17. }
  18. if (node.declare) {
  19. this.word("declare");
  20. this.space();
  21. }
  22. if (node.abstract) {
  23. this.word("abstract");
  24. this.space();
  25. }
  26. this.word("class");
  27. if (node.id) {
  28. this.space();
  29. this.print(node.id, node);
  30. }
  31. this.print(node.typeParameters, node);
  32. if (node.superClass) {
  33. this.space();
  34. this.word("extends");
  35. this.space();
  36. this.print(node.superClass, node);
  37. this.print(node.superTypeParameters, node);
  38. }
  39. if (node.implements) {
  40. this.space();
  41. this.word("implements");
  42. this.space();
  43. this.printList(node.implements, node);
  44. }
  45. this.space();
  46. this.print(node.body, node);
  47. }
  48. function ClassBody(node) {
  49. this.token("{");
  50. this.printInnerComments(node);
  51. if (node.body.length === 0) {
  52. this.token("}");
  53. } else {
  54. this.newline();
  55. this.indent();
  56. this.printSequence(node.body, node);
  57. this.dedent();
  58. if (!this.endsWith("\n")) this.newline();
  59. this.rightBrace();
  60. }
  61. }
  62. function ClassProperty(node) {
  63. this.printJoin(node.decorators, node);
  64. this.source("end", node.key.loc);
  65. this.tsPrintClassMemberModifiers(node, true);
  66. if (node.computed) {
  67. this.token("[");
  68. this.print(node.key, node);
  69. this.token("]");
  70. } else {
  71. this._variance(node);
  72. this.print(node.key, node);
  73. }
  74. if (node.optional) {
  75. this.token("?");
  76. }
  77. if (node.definite) {
  78. this.token("!");
  79. }
  80. this.print(node.typeAnnotation, node);
  81. if (node.value) {
  82. this.space();
  83. this.token("=");
  84. this.space();
  85. this.print(node.value, node);
  86. }
  87. this.semicolon();
  88. }
  89. function ClassPrivateProperty(node) {
  90. this.printJoin(node.decorators, node);
  91. if (node.static) {
  92. this.word("static");
  93. this.space();
  94. }
  95. this.print(node.key, node);
  96. this.print(node.typeAnnotation, node);
  97. if (node.value) {
  98. this.space();
  99. this.token("=");
  100. this.space();
  101. this.print(node.value, node);
  102. }
  103. this.semicolon();
  104. }
  105. function ClassMethod(node) {
  106. this._classMethodHead(node);
  107. this.space();
  108. this.print(node.body, node);
  109. }
  110. function ClassPrivateMethod(node) {
  111. this._classMethodHead(node);
  112. this.space();
  113. this.print(node.body, node);
  114. }
  115. function _classMethodHead(node) {
  116. this.printJoin(node.decorators, node);
  117. this.source("end", node.key.loc);
  118. this.tsPrintClassMemberModifiers(node, false);
  119. this._methodHead(node);
  120. }
  121. function StaticBlock(node) {
  122. this.word("static");
  123. this.space();
  124. this.token("{");
  125. if (node.body.length === 0) {
  126. this.token("}");
  127. } else {
  128. this.newline();
  129. this.printSequence(node.body, node, {
  130. indent: true
  131. });
  132. this.rightBrace();
  133. }
  134. }