Sha256: 85d5903439fd00bbe6ecd63589001ca8dc0679fe9896c4be7d367e0a4e28ec03
Contents?: true
Size: 1.1 KB
Versions: 11
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Unparser class Emitter # Base class for and and or op-assign class BinaryAssign < self include Unterminated children :target, :expression MAP = IceNine.deep_freeze( and_asgn: '&&=', or_asgn: '||=' ) handle(*MAP.keys) private # Perform dispatch # # @return [undefined] # # @api private # def dispatch visit(target) write(WS, MAP.fetch(node.type), WS) visit(expression) end end # BinaryAssign # Emitter for op assign class OpAssign < self include Unterminated handle :op_asgn private # Perform dispatch # # @return [undefined] # # @api private # def dispatch visit(first_child) emit_operator visit(children[2]) end # Emit operator # # @return [undefined] # # @api private # def emit_operator write(WS, children[1].to_s, T_ASN, WS) end end # OpAssign end # Emitte end # Unparser
Version data entries
11 entries across 11 versions & 1 rubygems