Apply workaround for static class method call

This commit is contained in:
dalance 2019-11-06 11:31:37 +09:00
parent 32cbf3a804
commit 0af347032a
4 changed files with 22 additions and 14 deletions

View File

@ -2,6 +2,7 @@
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.3.6...Unreleased) - ReleaseDate
* [Fixed] apply workaround for static class method call
* [Fixed] randomize_call bug
## [v0.3.6](https://github.com/dalance/sv-parser/compare/v0.3.5...v0.3.6) - 2019-11-05

View File

@ -595,7 +595,10 @@ pub(crate) fn ps_or_hierarchical_tf_identifier(
pub(crate) fn ps_or_hierarchical_tf_identifier_package_scope(
s: Span,
) -> IResult<Span, PsOrHierarchicalTfIdentifier> {
let (s, a) = opt(package_scope)(s)?;
// BNF-WA
// reported at https://accellera.mantishub.io/view.php?id=1642
//let (s, a) = opt(package_scope)(s)?;
let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?;
let (s, b) = tf_identifier(s)?;
Ok((
s,

View File

@ -3177,21 +3177,22 @@ mod spec {
bit arr[obj.q]; // illegal: local parameter is not a constant expression"##,
Ok((_, _))
);
// TODO
// BNF-WA
// reported at https://accellera.mantishub.io/view.php?id=1642
// class static method is denied because ps_or_hierarchical_tf_identifier doesn't have class_scope.
//test!(
// many1(module_item),
// r##"class C #(int p = 1, type T = int);
// extern static function T f();
// endclass
test!(
many1(module_item),
r##"class C #(int p = 1, type T = int);
extern static function T f();
endclass
// function C::T C::f();
// return p + C::p;
// endfunction
function C::T C::f();
return p + C::p;
endfunction
// initial $display("%0d %0d", C#()::f(),C#(5)::f()); // output is "2 10""##,
// Ok((_, _))
//);
initial $display("%0d %0d", C#()::f(),C#(5)::f()); // output is "2 10""##,
Ok((_, _))
);
test!(
many1(module_item),
r##"interface class A;

View File

@ -392,7 +392,10 @@ pub enum PsOrHierarchicalTfIdentifier {
#[derive(Clone, Debug, PartialEq, Node)]
pub struct PsOrHierarchicalTfIdentifierPackageScope {
pub nodes: (Option<PackageScope>, TfIdentifier),
pub nodes: (
Option<ImplicitClassHandleOrClassScopeOrPackageScope>,
TfIdentifier,
),
}
#[derive(Clone, Debug, PartialEq, Node)]