MCPcopy Create free account
hub / github.com/LambdaNote/support-ts-tapl / getSwitchVarName

Function getSwitchVarName

article/utils.ts:214–219  ·  view source on GitHub ↗
(node: p.TSESTree.Expression)

Source from the content-addressed store, hash-verified

212}
213
214function getSwitchVarName(node: p.TSESTree.Expression) {
215 if (node.type !== "MemberExpression" || node.computed || getIdentifier(node.property) !== "tag") {
216 error(`switch statement must be switch(VAR.tag) { ... }`, node);
217 }
218 return getIdentifier(node.object);
219}
220
221function getParam(node: p.TSESTree.Parameter): Param {
222 if (node.type !== "Identifier") error("parameter must be a variable", node);

Callers 1

convertStmtFunction · 0.70

Calls 2

getIdentifierFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected