Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function* debDumbBindStmt(s) {
for (const i of s) {
switch (symName(i.type)) {
case "letStmt":
const hasBind = i.value.sym != null;
if (i.enter) {
if (hasBind) {
yield D.copyComment(
i,
D.setComment(
Kit.enter(i.pos, Tag.VariableDeclaration, {
node: {
kind: "var"
// kind:"const"
},
eff: i.value.eff
}),
"S",
"font-size:xx-large;color:orange"
)
);
yield Kit.enter(Tag.declarations, Tag.Array);
yield Kit.enter(Tag.push, Tag.VariableDeclarator);
yield Kit.tok(Tag.id, Tag.Identifier, { sym: i.value.sym });
yield Kit.enter(Tag.init, Kit.Subst);
} else {
yield D.copyComment(
export function tagValue(pos, type, v) {
if (v.tag != null) return v;
const info = symInfo(type);
const res = { tag: true };
res.id = curId++;
res.origType = type;
res.origPos = pos;
res.stmt = info.stmt;
res.expr = info.expr;
res.func = info.func;
res.coerce = info.coerce;
res.boundary =
(res.stmt && !(type === Tag.VariableDeclaration && pos === Tag.init)) ||
type === Tag.CatchClause;
Object.assign(res, v);
return res;
}
export function* openVarDecl(idNode, s, kind = "var") {
const value =
idNode.node === null
? { node: idNode, lhs: true, decl: true, rhs: false }
: idNode;
yield s.enter(Tag.init, Tag.VariableDeclaration, { node: { kind } });
yield s.enter(Tag.declarations, Tag.Array);
yield s.enter(Tag.push, Tag.VariableDeclarator);
yield tok(Tag.id, Tag.Identifier, value);
}
});
yield* Kit.reposOne(ids, Tag.left);
yield sl.tok(Tag.right, Tag.Identifier, {
sym,
lhs: false,
rhs: true,
decl: false
});
yield* blab();
yield* _saveDecls();
yield* lab();
}
continue;
}
break;
case Tag.VariableDeclaration:
const kind = i.value.node.kind;
i.value.node.kind = "var";
const declarators = [];
const stmt = i.pos !== Tag.init && i.pos !== Tag.left;
sl.peel(i);
sl.peel();
for (const j of sl.sub()) {
invariant(j.enter);
invariant(j.type === Tag.VariableDeclarator);
let hasInit = false;
const asgn = [];
const id = [...sl.one()];
asgn.push(...id);
for (const j of id) {
if (j.enter && j.type === Tag.Identifier && j.value.decl) {
const sym = j.value.sym;