Class: SyntaxTree::Index::ISeqBackend
- Inherits:
-
Object
- Object
- SyntaxTree::Index::ISeqBackend
- Defined in:
- lib/syntax_tree/index.rb
Overview
This backend creates the index using RubyVM::InstructionSequence, which is faster than using the Syntax Tree parser, but is not available on all runtimes.
Constant Summary collapse
- VM_DEFINECLASS_TYPE_CLASS =
0x00
- VM_DEFINECLASS_TYPE_SINGLETON_CLASS =
0x01
- VM_DEFINECLASS_TYPE_MODULE =
0x02
- VM_DEFINECLASS_FLAG_SCOPED =
0x08
- VM_DEFINECLASS_FLAG_HAS_SUPERCLASS =
0x10
Instance Method Summary collapse
Instance Method Details
#index(source) ⇒ Object
184 185 186 187 188 189 |
# File 'lib/syntax_tree/index.rb', line 184 def index(source) index_iseq( RubyVM::InstructionSequence.compile(source).to_a, FileComments.new(FileComments::StringSource.new(source)) ) end |
#index_file(filepath) ⇒ Object
191 192 193 194 195 196 |
# File 'lib/syntax_tree/index.rb', line 191 def index_file(filepath) index_iseq( RubyVM::InstructionSequence.compile_file(filepath).to_a, FileComments.new(FileComments::FileSource.new(filepath)) ) end |