Class: Furnace::AVM2::ABC::MethodBodyInfo
- Inherits:
-
Record
- Object
- Binary::Record
- Record
- Furnace::AVM2::ABC::MethodBodyInfo
- Includes:
- RecordWithTraits
- Defined in:
- lib/furnace-avm2/abc/metadata/method_body_info.rb
Instance Attribute Summary
Attributes inherited from Binary::Record
Instance Method Summary collapse
- #after_read(io) ⇒ Object
- #code_to_ast(options = {}) ⇒ Object
- #code_to_cfg ⇒ Object
- #code_to_nf ⇒ Object
- #collect_ns(options) ⇒ Object
- #decompile(options = {}) ⇒ Object
Methods included from RecordWithTraits
Methods inherited from Record
abc_array_of, flag, pool_array, pool_array_of, pool_ref, subset, xlat_direct, xlat_field, xlat_inverse
Methods inherited from Binary::Record
#byte_length, codegen, codegen_each, inherited, #inspect, method_missing, register, #to_hash, trace, trace_scope, trace_value
Instance Method Details
#after_read(io) ⇒ Object
18 19 20 21 22 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 18 def after_read(io) exceptions.each do |exception| exception.resolve! end end |
#code_to_ast(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 24 def code_to_ast(={}) pipeline = Furnace::Transform::Pipeline.new([ Furnace::AVM2::Transform::ASTBuild.new(), Furnace::AVM2::Transform::ASTNormalize.new(), Furnace::AVM2::Transform::PropagateConstants.new, ]) pipeline.run(code, self) end |
#code_to_cfg ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 34 def code_to_cfg pipeline = Furnace::Transform::Pipeline.new([ Furnace::AVM2::Transform::PropagateLabels.new, Furnace::AVM2::Transform::CFGBuild.new ]) pipeline.run(*code_to_ast({})) end |
#code_to_nf ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 43 def code_to_nf pipeline = Furnace::Transform::Pipeline.new([ Furnace::AVM2::Transform::CFGReduce.new, Furnace::AVM2::Transform::NFNormalize.new, ]) pipeline.run(*code_to_cfg) end |
#collect_ns(options) ⇒ Object
56 57 58 59 60 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 56 def collect_ns() code.each do |opcode| opcode.collect_ns() if opcode.respond_to? :collect_ns end end |
#decompile(options = {}) ⇒ Object
52 53 54 |
# File 'lib/furnace-avm2/abc/metadata/method_body_info.rb', line 52 def decompile(={}) Furnace::AVM2::Decompiler.new(self, ).decompile end |