| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.DecimalLiteral = DecimalLiteral;
|
|---|
| 7 | exports.Noop = Noop;
|
|---|
| 8 | exports.RecordExpression = RecordExpression;
|
|---|
| 9 | exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
|
|---|
| 10 | exports.TupleExpression = TupleExpression;
|
|---|
| 11 | function Noop() {}
|
|---|
| 12 | function TSExpressionWithTypeArguments(node) {
|
|---|
| 13 | this.print(node.expression);
|
|---|
| 14 | this.print(node.typeParameters);
|
|---|
| 15 | }
|
|---|
| 16 | function DecimalLiteral(node) {
|
|---|
| 17 | const raw = this.getPossibleRaw(node);
|
|---|
| 18 | if (!this.format.minified && raw !== undefined) {
|
|---|
| 19 | this.word(raw);
|
|---|
| 20 | return;
|
|---|
| 21 | }
|
|---|
| 22 | this.word(node.value + "m");
|
|---|
| 23 | }
|
|---|
| 24 | function RecordExpression(node) {
|
|---|
| 25 | const props = node.properties;
|
|---|
| 26 | let startToken;
|
|---|
| 27 | let endToken;
|
|---|
| 28 | if (this.format.recordAndTupleSyntaxType === "bar") {
|
|---|
| 29 | startToken = "{|";
|
|---|
| 30 | endToken = "|}";
|
|---|
| 31 | } else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) {
|
|---|
| 32 | throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
|
|---|
| 33 | } else {
|
|---|
| 34 | startToken = "#{";
|
|---|
| 35 | endToken = "}";
|
|---|
| 36 | }
|
|---|
| 37 | this.token(startToken);
|
|---|
| 38 | if (props.length) {
|
|---|
| 39 | this.space();
|
|---|
| 40 | this.printList(props, this.shouldPrintTrailingComma(endToken), true, true);
|
|---|
| 41 | this.space();
|
|---|
| 42 | }
|
|---|
| 43 | this.token(endToken);
|
|---|
| 44 | }
|
|---|
| 45 | function TupleExpression(node) {
|
|---|
| 46 | const elems = node.elements;
|
|---|
| 47 | const len = elems.length;
|
|---|
| 48 | let startToken;
|
|---|
| 49 | let endToken;
|
|---|
| 50 | if (this.format.recordAndTupleSyntaxType === "bar") {
|
|---|
| 51 | startToken = "[|";
|
|---|
| 52 | endToken = "|]";
|
|---|
| 53 | } else if (this.format.recordAndTupleSyntaxType === "hash") {
|
|---|
| 54 | startToken = "#[";
|
|---|
| 55 | endToken = "]";
|
|---|
| 56 | } else {
|
|---|
| 57 | throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
|
|---|
| 58 | }
|
|---|
| 59 | this.token(startToken);
|
|---|
| 60 | for (let i = 0; i < elems.length; i++) {
|
|---|
| 61 | const elem = elems[i];
|
|---|
| 62 | if (elem) {
|
|---|
| 63 | if (i > 0) this.space();
|
|---|
| 64 | this.print(elem);
|
|---|
| 65 | if (i < len - 1 || this.shouldPrintTrailingComma(endToken)) {
|
|---|
| 66 | this.token(",", false, i);
|
|---|
| 67 | }
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 | this.token(endToken);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | //# sourceMappingURL=deprecated.js.map
|
|---|