| 608 | } |
| 609 | } |
| 610 | function typeexpr(type, value) { |
| 611 | if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") { |
| 612 | cx.marked = "keyword" |
| 613 | return cont(value == "typeof" ? expressionNoComma : typeexpr) |
| 614 | } |
| 615 | if (type == "variable" || value == "void") { |
| 616 | cx.marked = "type" |
| 617 | return cont(afterType) |
| 618 | } |
| 619 | if (value == "|" || value == "&") return cont(typeexpr) |
| 620 | if (type == "string" || type == "number" || type == "atom") return cont(afterType); |
| 621 | if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) |
| 622 | if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType) |
| 623 | if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType) |
| 624 | if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr) |
| 625 | } |
| 626 | function maybeReturnType(type) { |
| 627 | if (type == "=>") return cont(typeexpr) |
| 628 | } |