Skip to content

Commit

Permalink
Add manual type guard for __GET_ITEMS__
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnaldo committed Sep 19, 2024
1 parent 48c9c0f commit 723064f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/scala/esmeta/analyzer/TypeAnalyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ class TypeAnalyzer(
"__FLAT_LIST__" -> { (xs, vs, retTy) =>
AbsValue(vs(0).ty.list.elem, Map())
},
"__GET_ITEMS__" -> { (xs, vs, retTy) =>
val ast = vs(1).ty.toValue.grammarSymbol match
case Fin(set) => AstT(set.map(_.name))
case Inf => AstT
AbsValue(ListT(ast), Map())
},
"Completion" -> { (xs, vs, retTy) =>
AbsValue(vs(0).ty && CompT, Map())
},
Expand Down

0 comments on commit 723064f

Please sign in to comment.