Class: SFRP::Raw::MatchExp::Pattern

Inherits:
Struct
  • Object
show all
Defined in:
lib/sfrp/raw/expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



54
55
56
# File 'lib/sfrp/raw/expression.rb', line 54

def args
  @args
end

#ref_var_strObject

Returns the value of attribute ref_var_str

Returns:

  • (Object)

    the current value of ref_var_str



54
55
56
# File 'lib/sfrp/raw/expression.rb', line 54

def ref_var_str
  @ref_var_str
end

#spObject

Returns the value of attribute sp

Returns:

  • (Object)

    the current value of sp



54
55
56
# File 'lib/sfrp/raw/expression.rb', line 54

def sp
  @sp
end

#vconst_refObject

Returns the value of attribute vconst_ref

Returns:

  • (Object)

    the current value of vconst_ref



54
55
56
# File 'lib/sfrp/raw/expression.rb', line 54

def vconst_ref
  @vconst_ref
end

Instance Method Details

#to_flat(set, ns) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/sfrp/raw/expression.rb', line 59

def to_flat(set, ns)
  flat_args = args.map { |a| a.to_flat(set, ns) }
  if vconst_ref
    ab_vc_name = set.vconst(ns, vconst_ref, sp).absolute_name
    Flat::MatchExp::Pattern.new(ab_vc_name, ref_var_str, flat_args, sp)
  else
    Flat::MatchExp::Pattern.new(nil, ref_var_str, flat_args, sp)
  end
end

#vconst_refsObject



55
56
57
# File 'lib/sfrp/raw/expression.rb', line 55

def vconst_refs
  (vconst_ref ? [vconst_ref] : []) + args.flat_map(&:vconst_refs)
end