Skip to content

Commit d4fc1f0

Browse files
authored
Merge pull request #2393 from apiology/maintain_environment_api_compatibility
Restore RBS::Environment#declarations for backwards-compatibility
2 parents f91bbb3 + 59cc171 commit d4fc1f0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/rbs/environment.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class Environment
1111

1212
attr_reader :sources
1313

14+
def declarations
15+
sources.flat_map(&:declarations)
16+
end
17+
1418
class SingleEntry
1519
attr_reader :name
1620
attr_reader :context

sig/environment.rbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module RBS
3030
class GlobalEntry < SingleEntry[Symbol, AST::Declarations::Global]
3131
end
3232

33+
# Top level declarations
34+
def declarations: () -> Array[AST::Ruby::Declarations::t | AST::Declarations::t]
35+
3336
# Array of source objects loaded in the environment
3437
#
3538
attr_reader sources: Array[Source::t]

0 commit comments

Comments
 (0)