Fix method calls on function return values.

This commit is contained in:
Wilson Snyder 2023-05-29 18:51:27 -04:00
parent 1c0739db10
commit e9135598b3
4 changed files with 57 additions and 0 deletions

View File

@ -48,6 +48,7 @@ Verilator 5.011 devel
* Fix missing assignment for wide unpacked structs (#4233). [Jiamin Zhu]
* Fix detection of wire/reg duplicates.
* Fix false IMPLICITSTATIC on package functions.
* Fix method calls on function return values.
Verilator 5.010 2023-04-30

View File

@ -3040,6 +3040,10 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
} else if (m_ds.m_dotp && m_ds.m_dotPos == DP_SCOPE) {
// HERE function() . method_called_on_function_return_value()
m_ds.m_dotPos = DP_MEMBER;
m_ds.m_dotText = "";
} else {
checkNoDot(nodep);
}

View File

@ -0,0 +1,21 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
compile(
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -0,0 +1,31 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Cls_report_object;
string m_msg;
function string get_msg;
return m_msg;
endfunction
endclass
function Cls_report_object get_report_object;
Cls_report_object c;
c = new;
c.m_msg = "hello";
return c;
endfunction
module t (/*AUTOARG*/);
string s;
initial begin
Cls_report_object _local_report_object;
s = get_report_object().get_msg();
$write("*-* All Finished *-*\n");
$finish;
end
endmodule