Skip to content

Commit

Permalink
Put xrefs in a few more spots (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane authored Sep 30, 2023
1 parent a2de7f4 commit b723099
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions sphinx_js/typedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,14 +959,11 @@ def inner(param: Param) -> Iterator[str | ir.TypeXRef]:
yield ") => "
return_type = self.return_type(converter)
if return_type:
ret = return_type[0].type
res = return_type[0].type
assert isinstance(res, list)
yield from res
else:
ret = "void"
assert ret
if isinstance(ret, str):
yield ret
else:
yield from ret
yield ir.TypeXRefIntrinsic("void")

def to_ir(
self, converter: Converter
Expand Down Expand Up @@ -1135,11 +1132,11 @@ class LiteralType(TypeBase):

def _render_name_root(self, converter: Converter) -> Iterator[str | ir.TypeXRef]:
if self.value is None:
yield "null"
yield ir.TypeXRefIntrinsic("null")
return
# TODO: it could be a bigint or a string?
if isinstance(self.value, int):
yield "number"
yield ir.TypeXRefIntrinsic("number")
return
yield "<TODO: Unknown type>"
return
Expand Down
2 changes: 1 addition & 1 deletion tests/test_typedoc_analysis/test_typedoc_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def test_interface_function_member(self):
def test_variable(self):
"""Make sure top-level consts and vars are found."""
const = self.analyzer.get_object(["topLevelConst"])
assert const.type == ["number"]
assert const.type == [TypeXRefIntrinsic("number")]

def test_function(self):
"""Make sure Functions, Params, and Returns are built properly for
Expand Down

0 comments on commit b723099

Please sign in to comment.