Skip to content

Commit

Permalink
Show return edges in detailed-types / Refine return type of Await
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnaldo committed Sep 18, 2024
1 parent 30d7edc commit 896dd37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/scala/esmeta/analyzer/AbsSemantics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ trait AbsSemanticsDecl { self: Analyzer =>
s"$k -> $st"
case rp: ReturnPoint =>
val st = this(rp).getString(detail = detail)
s"$k -> $st"
s"$k -> $st" + (
if (detail)
getRetEdges(rp).toList.sorted
.map("\n " + _.toString)
.mkString(" -> [", ",", "\n]")
else ""
)

/** conversion to string */
override def toString: String = shortString
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/esmeta/analyzer/TypeAnalyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class TypeAnalyzer(
"MakeBasicObject" -> { (xs, vs, retTy) =>
AbsValue(RecordT("Object"), Map())
},
"Await" -> { (xs, vs, retTy) =>
AbsValue(NormalT(ESValueT) || ThrowT, Map())
},
"IsCallable" -> { (xs, vs, retTy) =>
var map: Refinements = Map()
xs(0).map { x => map += True -> Map(x -> RecordT("FunctionObject")) }
Expand Down

0 comments on commit 896dd37

Please sign in to comment.