class Prism::DesugarCompiler - Documentation for Ruby 4.1
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 305
    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 327
    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 316
    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 338
    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 360
    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 349
    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 371
    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 393
    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 382
    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 404
    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 426
    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 415
    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 437
    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 459
    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 448
    def visit_local_variable_or_write_node(node)
      node.desugar
    end

`foo ||= bar`

becomes

`foo || foo = bar`