Skip to content

Commit

Permalink
fix(analyzer): correct handling of variables in embedded args in keyw…
Browse files Browse the repository at this point in the history
…ord calls

closes #360
  • Loading branch information
d-biehl committed Nov 26, 2024
1 parent 18b6cb8 commit 2c8ed56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def generate_sem_sub_tokens(
):
if (
namespace.find_keyword(
token.value,
unescape(token.value), # TODO: this must be resovle possible variables
raise_keyword_error=False,
handle_bdd_style=False,
)
Expand Down Expand Up @@ -458,7 +458,9 @@ def generate_sem_sub_tokens(

kw_namespace: Optional[str] = None
kw: str = token.value
kw_doc = namespace.find_keyword(token.value, raise_keyword_error=False)
kw_doc = namespace.find_keyword(
unescape(token.value), raise_keyword_error=False
) # TODO: this must be resovle possible variables

(
lib_entry,
Expand Down Expand Up @@ -1121,14 +1123,14 @@ def get_tokens() -> Iterator[Tuple[Token, ast.AST]]:
kw: Optional[str] = None

for _, n in iter_over_keyword_names_and_owners(
ModelHelper.strip_bdd_prefix(namespace, kw_token).value
unescape(ModelHelper.strip_bdd_prefix(namespace, kw_token).value)
):
if n is not None:
matcher = KeywordMatcher(n)
if matcher in ALL_RUN_KEYWORDS_MATCHERS:
kw = n
if kw:
kw_doc = namespace.find_keyword(kw_token.value)
kw_doc = namespace.find_keyword(unescape(kw_token.value))
if kw_doc is not None and kw_doc.is_any_run_keyword():
for kw_res in self.generate_run_kw_tokens(
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,11 @@ def _analyze_keyword_call(
analyze_run_keywords: bool = True,
allow_variables: bool = False,
ignore_errors_if_contains_variables: bool = False,
unescape_keyword: bool = True,
) -> Optional[KeywordDoc]:
result: Optional[KeywordDoc] = None

keyword = unescape(keyword_token.value)
keyword = unescape(keyword_token.value) if unescape_keyword else keyword_token.value

try:
lib_entry = None
Expand Down Expand Up @@ -1008,9 +1009,7 @@ def visit_KeywordCall(self, node: KeywordCall) -> None: # noqa: N802
self._analyze_statement_variables(node)

self._analyze_keyword_call(
node,
keyword_token,
[e for e in node.get_tokens(Token.ARGUMENT)],
node, keyword_token, [e for e in node.get_tokens(Token.ARGUMENT)], unescape_keyword=False
)

if not self._current_testcase_or_keyword_name:
Expand Down

0 comments on commit 2c8ed56

Please sign in to comment.