Skip to content

Commit 8b511d5

Browse files
committed
chore: Fix parent scope issue in FortranAST class
Fixes #329
1 parent bd931e6 commit 8b511d5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
### Fixed
4444

45+
- Fixed bug where parent scope for includes in AST could be `None`
46+
([#329](https://github.com/fortran-lang/fortls/issues/329))
4547
- Fixed preprocessor bug with `if` and `elif` conditionals
4648
([#322](https://github.com/fortran-lang/fortls/issues/322))
4749
- Fixed bug where type fields or methods were not detected if spaces were

fortls/parsers/internal/ast.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ def resolve_includes(self, workspace, path: str | None = None):
272272
added_entities = []
273273
for child in include_ast.inc_scope.children:
274274
added_entities.append(child)
275-
parent_scope.add_child(child)
276-
child.update_fqsn(parent_scope.FQSN)
275+
if parent_scope is not None:
276+
parent_scope.add_child(child)
277+
child.update_fqsn(parent_scope.FQSN)
277278
include_ast.none_scope = parent_scope
278279
inc.scope_objs = added_entities
279280

0 commit comments

Comments
 (0)