Skip to content

Commit 8446ca7

Browse files
authored
Merge pull request #292 from diffblue/verilog-this
Verilog: this
2 parents 87f7f4a + b24fd75 commit 8446ca7

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
this1.sv
3+
4+
^file .* line 3: 'this' outside of method$
5+
^EXIT=2$
6+
^SIGNAL=0$
7+
--
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module main;
2+
3+
wire y = this;
4+
5+
endmodule

src/verilog/parser.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3661,6 +3661,7 @@ primary: primary_literal
36613661
| cast
36623662
| assignment_pattern_expression
36633663
| TOK_NULL { init($$, ID_NULL); }
3664+
| TOK_THIS { init($$, ID_this); }
36643665
;
36653666

36663667
primary_literal:

src/verilog/verilog_typecheck_expr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,11 @@ exprt verilog_typecheck_exprt::convert_nullary_expr(nullary_exprt expr)
912912
expr.type() = elaborate_type(expr.type());
913913
return std::move(expr);
914914
}
915+
else if(expr.id() == ID_this)
916+
{
917+
throw errort().with_location(expr.source_location())
918+
<< "'this' outside of method";
919+
}
915920
else
916921
{
917922
throw errort().with_location(expr.source_location())

0 commit comments

Comments
 (0)