Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Nov 6, 2024
1 parent 0db911c commit d576487
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tools/chpl-language-server/src/symbol_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ def _wrap_str(s: str) -> Component:
return Component(ComponentTag.STRING, s)


def _wrap_in(s: Union[Component, List[Component]], wrapper: Tuple[str, str]) -> List[Component]:
def _wrap_in(
s: Union[Component, List[Component]], wrapper: Tuple[str, str]
) -> List[Component]:
center = s if isinstance(s, list) else [s]
return [_wrap_str(wrapper[0])] + center + [_wrap_str(wrapper[1])]


class SymbolSignature:
def __init__(self, node: chapel.AstNode):
self.node = node
Expand Down Expand Up @@ -357,14 +360,23 @@ def _fncall_to_string(call: chapel.FnCall) -> List[Component]:
comps = _wrap_in(comps, ("(", ")")) if call.parenth_location() else comps
return comps


def _is_special_fncall(call: chapel.FnCall) -> bool:
"""
Check if the function call is a special function call
"""
called = call.called_expression()
if not isinstance(called, chapel.Identifier):
return False
return called.name() in ("sync", "atomic", "owned", "shared", "borrowed", "unmanaged")
return called.name() in (
"sync",
"atomic",
"owned",
"shared",
"borrowed",
"unmanaged",
)


def _special_fncall_to_string(call: chapel.FnCall) -> List[Component]:
"""
Expand Down

0 comments on commit d576487

Please sign in to comment.