class Prism::DesugarCompiler
DesugarCompiler
是一个将 Ruby 代码解糖为更原始形式的编译器。 这对于想要处理更少节点类型的消费者很有用。
公共实例方法
visit_class_variable_and_write_node(node) 点击以切换源代码
@@foo &&= bar
变成
@@foo && @@foo = bar
# File 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
变成
@@foo = @@foo + bar
# File 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
变成
defined?(@@foo) ? @@foo : @@foo = bar
# File 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
变成
Foo && Foo = bar
# File prism/desugar_compiler.rb, line 288 def visit_constant_and_write_node(node) node.desugar end
visit_constant_operator_write_node(node) 点击以切换源代码
Foo += bar
变成
Foo = Foo + bar
# File prism/desugar_compiler.rb, line 306 def visit_constant_operator_write_node(node) node.desugar end
visit_constant_or_write_node(node) 点击以切换源代码
Foo ||= bar
变成
defined?(Foo) ? Foo : Foo = bar
# File 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
变成
$foo && $foo = bar
# File 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
变成
$foo = $foo + bar
# File 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
变成
defined?($foo) ? $foo : $foo = bar
# File prism/desugar_compiler.rb, line 324 def visit_global_variable_or_write_node(node) node.desugar end
visit_instance_variable_and_write_node(node) 点击以切换源代码
@foo &&= bar
变成
@foo && @foo = bar
# File prism/desugar_compiler.rb, line 342 def visit_instance_variable_and_write_node(node) node.desugar end
visit_instance_variable_operator_write_node(node) 点击以切换源代码
@foo += bar
变成
@foo = @foo + bar
# File prism/desugar_compiler.rb, line 360 def visit_instance_variable_operator_write_node(node) node.desugar end
visit_instance_variable_or_write_node(node) 点击以切换源代码
@foo ||= bar
变成
@foo || @foo = bar
# File 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
变成
foo && foo = bar
# File 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
变成
foo = foo + bar
# File 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
变成
foo || foo = bar
# File prism/desugar_compiler.rb, line 378 def visit_local_variable_or_write_node(node) node.desugar end