Skip to content

Commit 585612a

Browse files
committed
Remove the WithScope extension
1 parent 3e3bbe6 commit 585612a

File tree

4 files changed

+0
-900
lines changed

4 files changed

+0
-900
lines changed

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ It is built with only standard library dependencies. It additionally ships with
4545
- [visit_methods](#visit_methods)
4646
- [BasicVisitor](#basicvisitor)
4747
- [MutationVisitor](#mutationvisitor)
48-
- [WithScope](#withscope)
4948
- [Language server](#language-server)
5049
- [textDocument/formatting](#textdocumentformatting)
5150
- [textDocument/inlayHint](#textdocumentinlayhint)
@@ -621,26 +620,6 @@ SyntaxTree::Formatter.format(source, program.accept(visitor))
621620
# => "if (a = 1)\nend\n"
622621
```
623622

624-
### WithScope
625-
626-
The `WithScope` module can be included in visitors to automatically keep track of local variables and arguments defined inside each scope. A `current_scope` accessor is made available to the request, allowing it to find all usages and definitions of a local.
627-
628-
```ruby
629-
class MyVisitor < Visitor
630-
prepend WithScope
631-
632-
def visit_ident(node)
633-
# find_local will return a Local for any local variables or arguments
634-
# present in the current environment or nil if the identifier is not a local
635-
local = current_scope.find_local(node)
636-
637-
puts local.type # the type of the local (:variable or :argument)
638-
puts local.definitions # the array of locations where this local is defined
639-
puts local.usages # the array of locations where this local occurs
640-
end
641-
end
642-
```
643-
644623
## Language server
645624

646625
Syntax Tree additionally ships with a language server conforming to the [language server protocol](https://microsoft.github.io/language-server-protocol/). It can be invoked through the CLI by running:

lib/syntax_tree.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ module SyntaxTree
3434
autoload :Pattern, "syntax_tree/pattern"
3535
autoload :PrettyPrintVisitor, "syntax_tree/pretty_print_visitor"
3636
autoload :Search, "syntax_tree/search"
37-
autoload :WithScope, "syntax_tree/with_scope"
3837

3938
# This holds references to objects that respond to both #parse and #format
4039
# so that we can use them in the CLI.

lib/syntax_tree/with_scope.rb

Lines changed: 0 additions & 311 deletions
This file was deleted.

0 commit comments

Comments
 (0)