class Prism::DesugarCompiler - Documentation for Ruby 4.0
Description: class Prism::DesugarCompiler: 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
Keywords: ruby,class,Prism::DesugarCompiler

🔍

No recent searches

# class Prism::DesugarCompiler

`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.

### Public Instance Methods

visit_class_variable_and_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 262
    def visit_class_variable_and_write_node(node)
      node.desugar
    end

@@foo &&= bar

becomes

@@foo && @@foo = bar

visit_class_variable_operator_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 280
    def visit_class_variable_operator_write_node(node)
      node.desugar
    end

@@foo += bar

becomes

@@foo = @@foo + bar

visit_class_variable_or_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 271
    def visit_class_variable_or_write_node(node)
      node.desugar
    end

@@foo ||= bar

becomes

defined?(@@foo) ? @@foo : @@foo = bar

visit_constant_and_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 289
    def visit_constant_and_write_node(node)
      node.desugar
    end

Foo &&= bar

becomes

Foo && Foo = bar

visit_constant_operator_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 307
    def visit_constant_operator_write_node(node)
      node.desugar
    end

Foo += bar

becomes

Foo = Foo + bar

visit_constant_or_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 298
    def visit_constant_or_write_node(node)
      node.desugar
    end

Foo ||= bar

becomes

defined?(Foo) ? Foo : Foo = bar

visit_global_variable_and_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 316
    def visit_global_variable_and_write_node(node)
      node.desugar
    end

$foo &&= bar

becomes

$foo && $foo = bar

visit_global_variable_operator_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 334
    def visit_global_variable_operator_write_node(node)
      node.desugar
    end

$foo += bar

becomes

$foo = $foo + bar

visit_global_variable_or_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 325
    def visit_global_variable_or_write_node(node)
      node.desugar
    end

$foo ||= bar

becomes

defined?($foo) ? $foo : $foo = bar

visit_instance_variable_and_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 343
    def visit_instance_variable_and_write_node(node)
      node.desugar
    end

@foo &&= bar

becomes

@foo && @foo = bar

visit_instance_variable_operator_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 361
    def visit_instance_variable_operator_write_node(node)
      node.desugar
    end

@foo += bar

becomes

@foo = @foo + bar

visit_instance_variable_or_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 352
    def visit_instance_variable_or_write_node(node)
      node.desugar
    end

@foo ||= bar

becomes

@foo || @foo = bar

visit_local_variable_and_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 370
    def visit_local_variable_and_write_node(node)
      node.desugar
    end

foo &&= bar

becomes

foo && foo = bar

visit_local_variable_operator_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 388
    def visit_local_variable_operator_write_node(node)
      node.desugar
    end

foo += bar

becomes

foo = foo + bar

visit_local_variable_or_write_node (node)
Source

    # File lib/prism/desugar_compiler.rb, line 379
    def visit_local_variable_or_write_node(node)
      node.desugar
    end

foo ||= bar

becomes

foo || foo = bar