Class: Prism::DesugarCompiler
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
MutationCompiler
|
|
Instance Chain:
self,
MutationCompiler
|
|
Inherits: |
MutationCompiler
|
Defined in: | lib/prism/desugar_compiler.rb |
Overview
DesugarCompiler
is a compiler that desugars Ruby code into a more primitive form. This is useful for consumers that want to deal with fewer node types.
Instance Method Summary
-
#visit_class_variable_and_write_node(node)
@@foo &&= bar.
-
#visit_class_variable_operator_write_node(node)
@@foo += bar.
-
#visit_class_variable_or_write_node(node)
@@foo ||= bar.
-
#visit_constant_and_write_node(node)
Foo &&= bar.
-
#visit_constant_operator_write_node(node)
Foo += bar.
-
#visit_constant_or_write_node(node)
Foo ||= bar.
-
#visit_global_variable_and_write_node(node)
$foo &&= bar.
-
#visit_global_variable_operator_write_node(node)
$foo += bar.
-
#visit_global_variable_or_write_node(node)
$foo ||= bar.
-
#visit_instance_variable_and_write_node(node)
becomes.
-
#visit_instance_variable_operator_write_node(node)
becomes.
-
#visit_instance_variable_or_write_node(node)
becomes.
-
#visit_local_variable_and_write_node(node)
foo &&= bar.
-
#visit_local_variable_operator_write_node(node)
foo += bar.
-
#visit_local_variable_or_write_node(node)
foo ||= bar.
Instance Method Details
#visit_class_variable_and_write_node(node)
@@foo &&= bar
becomes
@@foo && @@foo = bar
# File 'lib/prism/desugar_compiler.rb', line 261
def visit_class_variable_and_write_node(node) node.desugar end
#visit_class_variable_operator_write_node(node)
@@foo += bar
becomes
@@foo = @@foo + bar
# File 'lib/prism/desugar_compiler.rb', line 279
def visit_class_variable_operator_write_node(node) node.desugar end
#visit_class_variable_or_write_node(node)
@@foo ||= bar
becomes
defined?(@@foo) ? @@foo : @@foo = bar
# File 'lib/prism/desugar_compiler.rb', line 270
def visit_class_variable_or_write_node(node) node.desugar end
#visit_constant_and_write_node(node)
Foo &&= bar
becomes
Foo && Foo = bar
# File 'lib/prism/desugar_compiler.rb', line 288
def visit_constant_and_write_node(node) node.desugar end
#visit_constant_operator_write_node(node)
Foo += bar
becomes
Foo = Foo + bar
# File 'lib/prism/desugar_compiler.rb', line 306
def visit_constant_operator_write_node(node) node.desugar end
#visit_constant_or_write_node(node)
Foo ||= bar
becomes
defined?(Foo) ? Foo : Foo = bar
# File 'lib/prism/desugar_compiler.rb', line 297
def visit_constant_or_write_node(node) node.desugar end
#visit_global_variable_and_write_node(node)
$foo &&= bar
becomes
$foo && $foo = bar
# File 'lib/prism/desugar_compiler.rb', line 315
def visit_global_variable_and_write_node(node) node.desugar end
#visit_global_variable_operator_write_node(node)
$foo += bar
becomes
$foo = $foo + bar
# File 'lib/prism/desugar_compiler.rb', line 333
def visit_global_variable_operator_write_node(node) node.desugar end
#visit_global_variable_or_write_node(node)
$foo ||= bar
becomes
defined?($foo) ? $foo : $foo = bar
# File 'lib/prism/desugar_compiler.rb', line 324
def visit_global_variable_or_write_node(node) node.desugar end
#visit_instance_variable_and_write_node(node)
becomes
# File 'lib/prism/desugar_compiler.rb', line 342
def visit_instance_variable_and_write_node(node) node.desugar end
#visit_instance_variable_operator_write_node(node)
becomes
# File 'lib/prism/desugar_compiler.rb', line 360
def visit_instance_variable_operator_write_node(node) node.desugar end
#visit_instance_variable_or_write_node(node)
becomes
# File 'lib/prism/desugar_compiler.rb', line 351
def visit_instance_variable_or_write_node(node) node.desugar end
#visit_local_variable_and_write_node(node)
foo &&= bar
becomes
foo && foo = bar
# File 'lib/prism/desugar_compiler.rb', line 369
def visit_local_variable_and_write_node(node) node.desugar end
#visit_local_variable_operator_write_node(node)
foo += bar
becomes
foo = foo + bar
# File 'lib/prism/desugar_compiler.rb', line 387
def visit_local_variable_operator_write_node(node) node.desugar end
#visit_local_variable_or_write_node(node)
foo ||= bar
becomes
foo || foo = bar
# File 'lib/prism/desugar_compiler.rb', line 378
def visit_local_variable_or_write_node(node) node.desugar end