forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement global struct to hold needed values for nested functions
- Loading branch information
Showing
16 changed files
with
543 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module nested_03_a | ||
implicit none | ||
|
||
contains | ||
|
||
subroutine b() | ||
real :: x = 6 | ||
print *, "b()" | ||
call c() | ||
contains | ||
subroutine c() | ||
print *, 5 | ||
print *, x | ||
end subroutine c | ||
end subroutine b | ||
|
||
end module | ||
|
||
program nested_03 | ||
use nested_03_a, only: b | ||
implicit none | ||
|
||
call b() | ||
|
||
end |
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,31 @@ | ||
module nested_04_a | ||
implicit none | ||
|
||
contains | ||
|
||
integer function b(x) | ||
integer, intent(in) :: x | ||
integer y | ||
real :: yy = 6.6 | ||
y = x | ||
print *, "b()" | ||
b = c(6) | ||
contains | ||
integer function c(z) | ||
integer, intent(in) :: z | ||
print *, z | ||
print *, y | ||
print *, yy | ||
c = z | ||
end function c | ||
end function b | ||
|
||
end module | ||
|
||
program nested_04 | ||
use nested_04_a, only: b | ||
implicit none | ||
integer test | ||
test = b(5) | ||
|
||
end |
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.