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
159 160 161 162 163 164 |
# File 'lib/syntax_tree/index.rb', line 159 def index(source) index_iseq( RubyVM::InstructionSequence.compile(source).to_a, FileComments.new(FileComments::StringSource.new(source)) ) end |
#index_file(filepath) ⇒ Object
166 167 168 169 170 171 |
# File 'lib/syntax_tree/index.rb', line 166 def index_file(filepath) index_iseq( RubyVM::InstructionSequence.compile_file(filepath).to_a, FileComments.new(FileComments::FileSource.new(filepath)) ) end |