-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce REF=
and REFERENCE_TO
#1251
Merged
Merged
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
91f485f
Initial commit w/ segfault 😎
volsa 963064b
Create ADR call in parser
volsa 5482c54
Merge branch 'master' of https://github.com/plc-lang/rusty into volsa…
volsa 9486255
Remove ReferenceAssignment node
volsa c79d74e
Initial commit
volsa d3a9e69
Merge branch 'volsa/ref-assignment' into volsa/referenceto
volsa acd5770
Introduce RefAssignment node, adjust codegen
volsa 525701d
Merge branch 'volsa/ref-assignment' into volsa/referenceto
volsa 29f7e96
polish
volsa 6496fa1
wip
volsa d4b0b00
Add REF= validation
volsa 75133b9
add is_reference_to field
volsa b0861e5
Add unit test
volsa 0e6d595
Validation
volsa 1ce7bc2
Merge branch 'master' into volsa/referenceto
volsa 65e32ff
Polish
volsa 04a3879
further (failing) tests
volsa d946dbd
Merge branch 'master' of https://github.com/plc-lang/rusty into volsa…
volsa 1cccae8
Merge branch 'volsa/referenceto' of https://github.com/plc-lang/rusty…
volsa a991a8c
polish
volsa 64b759a
convert correctness tests to lit
volsa 3f74eac
Feedback
volsa 892f676
Update E099.md
volsa 39da064
Add TODO for non-blocking issue
volsa 88f2c21
Merge branch 'master' into volsa/referenceto
volsa 180e51b
Feedback
volsa 05ee69f
Merge branch 'volsa/referenceto' of https://github.com/plc-lang/rusty…
volsa 1ccc09d
Delete tests/lit/single/pointer/referenceto_variable_uninitialized_ad…
volsa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
compiler/plc_diagnostics/src/diagnostics/error_codes/E098.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Invalid REF= assignment | ||
|
||
`REF=` assignments are considered valid if the left-hand side of the assignment is a pointer variable | ||
and the right-hand side is a variable of the type that is being referenced. | ||
|
||
For example assignments such as the following are invalid | ||
|
||
```smalltalk | ||
VAR | ||
foo : DINT; | ||
bar : DINT; | ||
qux : SINT; | ||
refFoo : REFERENCE TO DINT; | ||
END_VAR | ||
|
||
refFoo REF= 5; // `5` is not a variable | ||
foo REF= bar; // `foo` is not a pointer | ||
refFoo REF= qux; // `refFoo` and `qux` have different types, DINT vs SINT | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Invalid `REFERENCE TO` declaration | ||
|
||
`REFERENCE TO` variable declarations are considered valid if the referenced type is not of the following form | ||
* `foo : REFERENCE TO REFERENCE TO (* ... *)` | ||
* `foo : ARRAY[...] OF REFERENCE TO (* ... *)` | ||
* `foo : REF_TO REFERENCE TO (* ... *)` | ||
|
||
Furthermore `REFERENCE_TO` variables must not be initialized in their declaration, e.g. `foo : REFERENCE TO DINT := bar`. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, this is not entirely correct but will be addressed in the aliasing PR later on