JSTQL-JS-Transform/src/patterns/patterns.ts

77 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-09-13 12:45:06 +00:00
import { Statement, VariableDeclarator } from "@swc/types";
2023-09-25 11:45:29 +00:00
import { MatchStatement, WildCardType } from "../types";
2023-09-13 12:45:06 +00:00
export const from: MatchStatement = {
type: "VariableDeclaration",
span: {
start: 1,
end: 13,
ctxt: 0,
},
2023-09-25 11:45:29 +00:00
kind: WildCardType.ANYTHING,
2023-09-13 12:45:06 +00:00
declare: false,
declarations: [
{
type: "VariableDeclarator",
span: {
start: 5,
end: 12,
ctxt: 0,
},
id: {
type: "Identifier",
span: {
start: 5,
end: 6,
ctxt: 2,
},
value: "a",
optional: false,
},
init: {
type: "NumericLiteral",
span: {
start: 9,
end: 12,
ctxt: 0,
},
value: 100,
raw: "100",
},
definite: false,
},
],
};
export const to: VariableDeclarator[] = [
{
type: "VariableDeclarator",
span: {
start: 5,
end: 12,
ctxt: 0,
},
id: {
type: "Identifier",
span: {
start: 5,
end: 6,
ctxt: 2,
},
2023-09-25 11:45:29 +00:00
value: "Inserted_By_Program",
2023-09-13 12:45:06 +00:00
optional: false,
},
init: {
type: "NumericLiteral",
span: {
start: 9,
end: 12,
ctxt: 0,
},
value: 100,
2023-09-25 11:45:29 +00:00
raw: "InsertedValue!",
2023-09-13 12:45:06 +00:00
},
definite: false,
},
];