Skip to content

Commit b4b4e4d

Browse files
committed
Include all top-level declarations as exported identifiers
1 parent bf89f77 commit b4b4e4d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

internal/cadence/linter.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,15 @@ func (l *linter) getExportedIdentifiers(filePath string) []ast.Identifier {
553553

554554
func exportedIdentifiersFromProgram(program *ast.Program) []ast.Identifier {
555555
var identifiers []ast.Identifier
556-
for _, decl := range program.CompositeDeclarations() {
557-
identifiers = append(identifiers, decl.Identifier)
558-
}
559-
for _, decl := range program.InterfaceDeclarations() {
560-
identifiers = append(identifiers, decl.Identifier)
556+
for _, decl := range program.Declarations() {
557+
identifier := decl.DeclarationIdentifier()
558+
if identifier == nil {
559+
continue
560+
}
561+
if decl.DeclarationAccess() != ast.AccessAll {
562+
continue
563+
}
564+
identifiers = append(identifiers, *identifier)
561565
}
562566
return identifiers
563567
}

0 commit comments

Comments
 (0)