-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
162 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: (%COMPILE %s && %RUN) | %CHECK %s | ||
// CHECK: 5 | ||
FUNCTION main : DINT | ||
VAR | ||
a : REF_TO DINT; | ||
b : DINT := 5; | ||
END_VAR | ||
a REF= b; | ||
|
||
printf('%d$N', a^); | ||
END_FUNCTION |
17 changes: 17 additions & 0 deletions
17
tests/lit/single/pointer/referenceto_variable_referencing_itself.st
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,17 @@ | ||
// RUN: (%COMPILE %s && %RUN) | %CHECK %s | ||
// CHECK: 5 | ||
FUNCTION main : DINT | ||
VAR | ||
foo : REFERENCE TO DINT; | ||
bar : REFERENCE TO DINT; | ||
qux : DINT; | ||
END_VAR | ||
|
||
foo REF= bar; | ||
bar REF= qux; | ||
|
||
bar REF= bar; | ||
qux := 5; | ||
|
||
printf('%d$N', bar); // bar (-> bar) -> qux | ||
END_FUNCTION |
15 changes: 15 additions & 0 deletions
15
tests/lit/single/pointer/referenceto_variable_referencing_other_referenceto_variable.st
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,15 @@ | ||
// RUN: (%COMPILE %s && %RUN) | %CHECK %s | ||
// CHECK: 5 | ||
FUNCTION main : DINT | ||
VAR | ||
foo : REFERENCE TO DINT; | ||
bar : REFERENCE TO DINT; | ||
qux : DINT; | ||
END_VAR | ||
|
||
bar REF= qux; | ||
foo REF= bar; | ||
qux := 5; | ||
|
||
printf('%d$N', foo); // foo -> bar -> qux | ||
END_FUNCTION |
17 changes: 17 additions & 0 deletions
17
tests/lit/single/pointer/referenceto_variable_referencing_struct.st
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,17 @@ | ||
// RUN: (%COMPILE %s && %RUN) | %CHECK %s | ||
// CHECK: 5 | ||
TYPE Transaction : STRUCT | ||
id : DINT; | ||
amount : DINT; | ||
message : STRING; | ||
END_STRUCT END_TYPE | ||
|
||
FUNCTION main : DINT | ||
VAR | ||
txn : Transaction := (id := 1, amount := 5, message := 'whats up'); | ||
refTxn : REFERENCE TO Transaction; | ||
END_VAR | ||
|
||
refTxn REF= txn; | ||
printf('%d$N', refTxn.amount); | ||
END_FUNCTION |