-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwith-statement-f86ebfb7.js
2 lines (2 loc) · 11.3 KB
/
with-statement-f86ebfb7.js
1
2
function e(e,t,n){let i="if";if(void 0!==n.indent?i+=" (":i+="(",i+=e.serialize(t.test,n).code,void 0!==n.indent?i+=") ":i+=")",i+=e.serialize(t.consequent,n).code,t.alternate){const o=e.serialize(t.alternate,n);void 0!==n.indent?i+=" else ":o.code.startsWith("{")?i+="else":i+="else ",i+=o.code}return{code:i,ast:t}}function t(e,t,n){let i="case ";t.test?i+=e.serialize(t.test,n).code+":":i="default:";let o="";const s=n.indent;if(void 0!==s){o="\n";for(let e=0;e<s;e++)o+="\t";o+="\t",n.indent+=1}if(t.consequent.length)for(const s of t.consequent)i+=o+e.serialize(s,n).code;return void 0!==s&&(n.indent=s),{code:i,ast:t}}function n(e,t,n){let i="switch";void 0!==n.indent?i+=" (":i+="(",i+=e.serialize(t.discriminant,n).code;let o="",s="";if(void 0!==n.indent){i+=") {",o="\n";for(let e=0;e<n.indent;e++)o+="\t";s=o,o+="\t"}else i+="){";if(t.cases.length){const r=n.indent;void 0!==r&&(n.indent+=1);for(const s of t.cases)i+=o+e.serialize(s,n).code;void 0!==r&&(n.indent=r),i+=s}return i+="}",{code:i,ast:t}}function i(e,t,n){return t.label?{code:"break "+e.serialize(t.label,n).code+";",ast:t}:{code:"break;",ast:t}}function o(e,t,n){return t.label?{code:"continue "+e.serialize(t.label,n).code+";",ast:t}:{code:"continue;",ast:t}}function s(e,t,n){let i=e.serialize(t.label,n).code;return void 0!==n.indent?i+=": ":i+=":",i+=e.serialize(t.body,n).code,{code:i,ast:t}}function r(e,t,n){return t.argument?{code:"return "+e.serialize(t.argument,n).code+";",ast:t}:{code:"return;",ast:t}}function a(e,t,n){let i="catch";const o=void 0!==n.indent;return o&&(i+=" "),t.param&&(i+="("+e.serialize(t.param,n).code+")",o&&(i+=" ")),i+=e.serialize(t.body,n).code,{code:i,ast:t}}function c(e,t,n){return{code:"throw "+e.serialize(t.argument,n).code+";",ast:t}}function d(e,t,n){let i="try";const o=void 0!==n.indent;return o&&(i+=" "),i+=e.serialize(t.block,n).code,t.handler&&(o&&(i+=" "),i+=e.serialize(t.handler,n).code),t.finalizer&&(o&&(i+=" "),i+=e.serialize(t.finalizer,n).code),{code:i,ast:t}}function l(e,t,n){const i=n.indent,o=void 0!==i,s=e.serialize(t.left,n).code,r=e.serialize(t.right,n).code;let a=s;return o&&(a+=" "),a+=t.operator,o&&(n.indent=i,a+=" "),a+=r,{code:a,ast:t}}function p(e,t,n){const i=n.indent,o=void 0!==n.indent||"i"==t.operator[0];void 0!==i&&n.indent++;const s=e.serialize(t.left,n).code,r=e.serialize(t.right,n).code;let a;return a="BinaryExpression"==t.left.type||"LogicalExpression"==t.left.type||"SequenceExpression"==t.left.type||"AssignmentExpression"==t.left.type||"AwaitExpression"==t.left.type||"YieldExpression"==t.left.type||"ConditionalExpression"==t.left.type?"("+s+")":s,o&&(a+=" "),a+=t.operator,o&&(n.indent=i,a+=" "),"BinaryExpression"==t.right.type||"LogicalExpression"==t.right.type||"SequenceExpression"==t.right.type||"AssignmentExpression"==t.right.type||"AwaitExpression"==t.right.type||"YieldExpression"==t.right.type||"ConditionalExpression"==t.right.type?a+="("+r+")":a+=r,{code:a,ast:t}}function u(e,t,n){let i=e.serialize(t.callee,n).code;"ArrowFunctionExpression"!=t.callee.type&&"AwaitExpression"!=t.callee.type&&"AssignmentExpression"!=t.callee.type&&"BinaryExpression"!=t.callee.type&&"ConditionalExpression"!=t.callee.type&&"FunctionExpression"!=t.callee.type&&"LogicalExpression"!=t.callee.type&&"SequenceExpression"!=t.callee.type||(i="("+i+")");const o=n.indent;void 0!==o&&n.indent++,i+="(";let s=!0;for(const r of t.arguments){s?s=!1:i+=void 0===o?",":", ";const a=e.serialize(r,n).code;"SequenceExpression"==t.callee.type?i+="("+a+")":i+=a}return i+=")",n.indent=o,{code:i,ast:t}}function f(e,t,n){let i=e.serialize(t.test,n).code;"BinaryExpression"!=t.test.type&&"LogicalExpression"!=t.test.type&&"SequenceExpression"!=t.test.type&&"AssignmentExpression"!=t.test.type&&"AwaitExpression"!=t.test.type&&"YieldExpression"!=t.test.type&&"ConditionalExpression"!=t.test.type||(i="("+i+")");const o=n.indent;return i+=void 0!==o?" ? ":"?",i+=e.serialize(t.consequent,n).code,i+=void 0!==o?" : ":":",i+=e.serialize(t.alternate,n).code,{code:i,ast:t}}function y(e,t,n){const i=n.indent,o=void 0!==i||"i"==t.operator[0];void 0!==i&&n.indent++;const s=e.serialize(t.left,n).code,r=e.serialize(t.right,n).code;let a;return a="LogicalExpression"==t.left.type||"SequenceExpression"==t.left.type||"AssignmentExpression"==t.left.type||"AwaitExpression"==t.left.type||"YieldExpression"==t.left.type||"ConditionalExpression"==t.left.type?"("+s+")":s,o&&(a+=" "),a+=t.operator,o&&(n.indent=i,a+=" "),"LogicalExpression"==t.right.type||"SequenceExpression"==t.right.type||"AssignmentExpression"==t.right.type||"AwaitExpression"==t.right.type||"YieldExpression"==t.right.type||"ConditionalExpression"==t.right.type?a+="("+r+")":a+=r,{code:a,ast:t}}function x(e,t,n){let i=e.serialize(t.object,n).code;return"ArrowFunctionExpression"!=t.object.type&&"AwaitExpression"!=t.object.type&&"AssignmentExpression"!=t.object.type&&"BinaryExpression"!=t.object.type&&"ConditionalExpression"!=t.object.type&&"FunctionExpression"!=t.object.type&&"LogicalExpression"!=t.object.type&&"SequenceExpression"!=t.object.type&&"YieldExpression"!=t.object.type||(i="("+i+")"),t.computed?i+="[":i+=".",i+=e.serialize(t.property,n).code,t.computed&&(i+="]"),{code:i,ast:t}}function g(e,t,n){let i="new";const o=e.serialize(t.callee,n).code,s=n.indent;"BinaryExpression"==t.callee.type||"LogicalExpression"==t.callee.type||"SequenceExpression"==t.callee.type||"AssignmentExpression"==t.callee.type||"AwaitExpression"==t.callee.type||"YieldExpression"==t.callee.type||"ConditionalExpression"==t.callee.type?(void 0!==s&&(i+=" "),i+="("+o+")"):i+=" "+o,void 0!==s&&n.indent++,i+="(";let r=!0;for(const o of t.arguments){r?r=!1:i+=void 0===s?",":", ";const a=e.serialize(o,n).code;"SequenceExpression"==t.callee.type?i+="("+a+")":i+=a}return i+=")",n.indent=s,{code:i,ast:t}}function E(e,t,n){let i="",o=!0;const s=n.indent;for(const r of t.expressions){o?o=!1:i+=void 0===s?",":", ";const t=e.serialize(r,n).code;"SequenceExpression"==r.type?i+="("+t+")":i+=t}return{code:i,ast:t}}function z(e,t,n){let i="[";const o=t.elements.length,s=n.indent;if(o>2&&void 0!==s){n.indent++;let o="\n";for(let e=0;e<s;e++)o+="\t";const r=o;o+="\t";let a=!0;for(const s of t.elements)a?a=!1:i+=",",i+=o+(s?e.serialize(s,n).code:"");i+=r,n.indent=s}else if(0!=o){let o=!0;for(const r of t.elements)o?o=!1:i+=void 0!==s?", ":",",i+=r?e.serialize(r,n).code:""}return i+="]",{code:i,ast:t}}function v(e,t,n){let i="{";const o=t.properties.length,s=n.indent;if(o>2&&void 0!==s){n.indent++;let o="\n";for(let e=0;e<s;e++)o+="\t";const r=o;o+="\t";let a=!0;for(const s of t.properties)a?a=!1:i+=",",i+=o+(s?e.serialize(s,n).code:"");i+=r,n.indent=s}else if(0!=o){let o=!0;void 0!==s&&(i+=" ");for(const r of t.properties)o?o=!1:i+=void 0!==s?", ":",",i+=r?e.serialize(r,n).code:"";void 0!==s&&(i+=" ")}return i+="}",{code:i,ast:t}}function m(e,t,n){let i="";return"get"===t.kind?i="get ":"set"===t.kind&&(i="set "),t.computed&&(i+="["),i+=e.serialize(t.key,n).code,t.computed&&(i+="]"),t.shorthand&&!t.computed&&(void 0===n.es||n.es>2015)||(void 0!==n.indent?i+=": ":i+=":",i+=e.serialize(t.value,n).code),{code:i,ast:t}}function h(e,t,n){return{code:"this",ast:t}}function b(e,t,n){let i=e.serialize(t.argument,n).code;return"BinaryExpression"!=t.argument.type&&"LogicalExpression"!=t.argument.type&&"SequenceExpression"!=t.argument.type&&"AssignmentExpression"!=t.argument.type&&"AwaitExpression"!=t.argument.type&&"YieldExpression"!=t.argument.type&&"ConditionalExpression"!=t.argument.type||(i="("+i+")"),t.prefix?i=t.operator.length>1?t.operator+" "+i:t.operator+i:i+=t.operator,{code:i,ast:t}}function A(e,t,n){let i=e.serialize(t.argument,n).code;return"BinaryExpression"!=t.argument.type&&"LogicalExpression"!=t.argument.type&&"SequenceExpression"!=t.argument.type&&"AssignmentExpression"!=t.argument.type&&"AwaitExpression"!=t.argument.type&&"YieldExpression"!=t.argument.type&&"ConditionalExpression"!=t.argument.type||(i="("+i+")"),t.prefix?i=t.operator+i:i+=t.operator,{code:i,ast:t}}function w(e,t,n){let i="(";if(t.params.length){let o=!0;for(const s of t.params)o?o=!1:void 0!==n.indent?i+=", ":i+=",",i+=e.serialize(s,n).code}return void 0!==n.indent?i+=") ":i+=")",i+=e.serialize(t.body,n).code,{code:i,ast:t}}function q(e,t,n){let i="function";return t.async&&(i="async "+i),t.generator&&(i+="*"),t.id&&(i+=" "+e.serialize(t.id,n).code),i+=w(e,t,n).code,{code:i,ast:t}}function S(e,t,n){return q(e,t,n)}function j(e,t,n){return{code:t.name,ast:t}}function C(e,t,n){const i=typeof t.value;if("string"==i)return{code:JSON.stringify(t.value)};if("number"==i)return{code:t.value.toString()};if("bigint"==i)return{code:t.value.toString()+"n"};if("boolean"==i)return{code:t.value?"true":"false"};if("undefined"==i)return{code:"undefined"};if(null===t.value)return{code:"null"};if(t.value instanceof RegExp)return{code:t.value.toString()};let o="Unexpected literal type '"+i+"'";throw t.loc&&(t.loc.source?o+=" at "+t.loc.source+":":o+=" at position ",o+=t.loc.start.line+":"+t.loc.start.column),new Error(o)}function L(e,t,n){const i=[];for(const o of t.body)i.push(e.serialize(o,n).code);let o="";if(void 0!==n.indent){o+="\n";for(let e=0;e<n.indent;e++)o+="\t"}return{code:i.join(o),ast:t}}function B(e,t,n){return{code:"/"+t.regex.pattern+"/"+t.regex.flags,ast:t}}function Y(e,t,n){let i=(t.kind||"var")+" ",o=!0;const s=void 0!==n.indent;for(const r of t.declarations)o?o=!1:i+=s?", ":",",i+=e.serialize(r,n).code;return i+=";",{code:i,ast:t}}function k(e,t,n){let i=e.serialize(t.id,n).code;return t.init&&(void 0!==n.indent?i+=" = ":i+="=",i+=e.serialize(t.init,n).code),{code:i,ast:t}}function F(e,t,n){let i="do";const o=void 0!==n.indent;return o&&(i+=" "),i+=e.serialize(t.body,n).code,i+=o?" while (":"while(",i+=e.serialize(t.test,n).code+");",{code:i,ast:t}}function W(e,t,n){let i="for";const o=n.indent;return void 0!==o?(i+=" (",n.indent++):i+="(",i+=e.serialize(t.left,n).code,i.endsWith(";")&&(i=i.substring(0,i.length-1)),i+=" in "+e.serialize(t.right,n).code,void 0!==o?(n.indent=o,i+=") "):i+=")",i+=e.serialize(t.body,n).code,{code:i,ast:t}}function N(e,t,n){let i="for";const o=void 0!==n.indent;i+=o?" (":"(";let s=!0;if(t.init){const o=e.serialize(t.init,n).code;i+=o,s=!o.endsWith(";")}return s&&(o&&t.test?i+="; ":i+=";"),t.test&&(i+=e.serialize(t.test,n).code),o&&t.update?i+="; ":i+=";",t.update&&(i+=e.serialize(t.update,n).code),i+=o?") ":")",i+=e.serialize(t.body,n).code,{code:i,ast:t}}function O(e,t,n){let i="while";return void 0!==n.indent?i+=" (":i+="(",i+=e.serialize(t.test,n).code,void 0!==n.indent?i+=") ":i+=")",i+=e.serialize(t.body,n).code,{code:i,ast:t}}function R(e,t,n){const i=[],o=n.indent;void 0!==o&&n.indent++;for(const o of t.body)i.push(e.serialize(o,n).code);if(n.indent=o,void 0!==o&&i.length){let e="\n";for(let t=0;t<o;t++)e+="\t";const t=e+"\t";return{code:"{"+t+i.join(t)+e+"}"}}return{code:"{"+i.join("")+"}",ast:t}}function U(e,t,n){return{code:"debugger;",ast:t}}function D(e,t,n){return{code:";",ast:t}}function I(e,t,n){return{code:e.serialize(t.expression,n).code+";",ast:t}}function J(e,t,n){let i="while";return void 0!==n.indent?i+=" (":i+="(",i+=e.serialize(t.object,n).code,void 0!==n.indent?i+=") ":i+=")",i+=e.serialize(t.body,n).code,{code:i,ast:t}}export{z as A,R as B,o as C,U as D,I as E,S as F,j as I,C as L,x as M,g as N,v as O,L as P,B as R,n as S,c as T,b as U,Y as V,J as W,D as a,r as b,s as c,i as d,e,t as f,d as g,a as h,O as i,F as j,N as k,W as l,q as m,k as n,h as o,m as p,A as q,p as r,l as s,y as t,f as u,u as v,E as w,w as x};
//# sourceMappingURL=with-statement-f86ebfb7.js.map