File tree Expand file tree Collapse file tree 4 files changed +382
-1
lines changed Expand file tree Collapse file tree 4 files changed +382
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
31
31
([ #205 ] ( https://github.com/krvajal/vscode-fortran-support/issues/205 ) )
32
32
- Fixes labelled ` stop ` conditions
33
33
([ #172 ] ( https://github.com/krvajal/vscode-fortran-support/issues/172 ) )
34
+ - Fixes incorrect comment capture for type, abstract|extends types
35
+ ([ #262 ] ( https://github.com/krvajal/vscode-fortran-support/issues/262 ) )
34
36
35
37
### Added
36
38
Original file line number Diff line number Diff line change 2385
2385
{
2386
2386
"include" : " #dummy-variable-list"
2387
2387
},
2388
+ {
2389
+ "include" : " #comments"
2390
+ },
2388
2391
{
2389
2392
"comment" : " Derived type specification block." ,
2390
2393
"name" : " meta.block.specification.derived-type.fortran" ,
4460
4463
"name" : " punctuation.parentheses.left.fortran"
4461
4464
},
4462
4465
"3" : {
4463
- "name" : " entity.name.module .fortran"
4466
+ "name" : " entity.name.class.submodule .fortran"
4464
4467
}
4465
4468
},
4466
4469
"end" : " (\\ ))" ,
Original file line number Diff line number Diff line change
1
+ ! This is an example demonstrating abstraction and the benefit of using
2
+ ! submodules. However for convenience of testing all files have been merged to 1
3
+
4
+ ! base.f90
5
+ module BaseClass
6
+
7
+ implicit none
8
+
9
+ type, abstract :: Base ! <-- the base class with subroutine "sub"
10
+ contains
11
+ procedure (sub_interface), nopass, deferred :: sub
12
+ end type
13
+
14
+ interface
15
+ subroutine sub_interface (i ) ! <-- the interface is defined here
16
+ implicit none
17
+ integer , intent (in ) :: i
18
+ end subroutine sub_interface
19
+ end interface
20
+
21
+ end module BaseClass
22
+
23
+ ! child.f90
24
+ module ChildClass
25
+
26
+ use BaseClass
27
+ implicit none
28
+
29
+ type, extends(Base) :: Child ! <-- we extend the Base Class
30
+ contains
31
+ procedure , nopass :: sub
32
+ end type
33
+
34
+ interface
35
+ module subroutine sub (i ) ! <-- the interface for the submodule (unfortunately we have to declare the entire thing again)
36
+ implicit none
37
+ integer , intent (in ) :: i
38
+ end subroutine sub
39
+ end interface
40
+
41
+ end module ChildClass
42
+
43
+ ! sub.f90
44
+ submodule (ChildClass) ChildSub
45
+
46
+ contains
47
+
48
+ module procedure sub ! <-- we finally get to define the subroutine
49
+ print * , " The answer is :" , i
50
+ end procedure
51
+
52
+ end submodule
53
+
54
+ ! main.f90
55
+ program test
56
+
57
+ use ChildClass
58
+
59
+ implicit none
60
+
61
+ type (Child) :: c
62
+ integer :: i
63
+
64
+ do i= 1 , 10
65
+ call c% sub(i)
66
+ end do
67
+
68
+ end program test
You can’t perform that action at this time.
0 commit comments