Find implicit `this` in the containing class method
An unqualified method call inside a named block is elaborated from the block
scope. When the call resolves to another method in the same class, receiver
construction looks for the implicit `this` signal directly in that scope:
function int call_method();
begin : nested
return get_value();
end
endfunction
The signal belongs to the containing method scope, so the lookup returns null
and the compiler dereferences it.
Find the containing method first and obtain the implicit `this` signal from
that scope.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
c71709d75d
commit
b4d92f7bb9
|
|
@ -3340,9 +3340,12 @@ NetExpr* PECallFunction::elaborate_expr_(Design*des, NetScope*scope,
|
|||
use_search_results.scope = scope;
|
||||
use_search_results.path_tail.push_back(search_results.path_head.back());
|
||||
use_search_results.path_head.push_back(name_component_t(perm_string::literal(THIS_TOKEN)));
|
||||
use_search_results.net = scope->find_signal(perm_string::literal(THIS_TOKEN));
|
||||
use_search_results.type = use_search_results.net->net_type();
|
||||
NetScope *method_scope = find_method_containing_scope(*this, scope);
|
||||
ivl_assert(*this, method_scope);
|
||||
use_search_results.net = method_scope->find_signal(
|
||||
perm_string::literal(THIS_TOKEN));
|
||||
ivl_assert(*this, use_search_results.net);
|
||||
use_search_results.type = use_search_results.net->net_type();
|
||||
|
||||
return elaborate_expr_method_(des, scope, use_search_results);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue