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

Function getSwitchVarName

book/tiny-ts-parser.ts:561–566  ·  view source on GitHub ↗
(node: p.TSESTree.Expression)

Source from the content-addressed store, hash-verified

559}
560
561function getSwitchVarName(node: p.TSESTree.Expression) {
562 if (node.type !== "MemberExpression" || node.computed || getIdentifier(node.property) !== "tag") {
563 error(`switch statement must be switch(VAR.tag) { ... }`, node);
564 }
565 return getIdentifier(node.object);
566}
567
568function getParam(node: p.TSESTree.Parameter): Param {
569 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