Top Level Namespace

Defined Under Namespace

Modules: FastRuby, Inline, Kernel Classes: Class, Fixnum, Integer, Method, Object, Sexp, UnboundMethod

Instance Method Summary collapse

Instance Method Details

#fs(*args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fastruby/sexp_extension.rb', line 32

def fs(*args)
  if String === args.first
    tree = FastRuby::FastRubySexp.parse(args.first)

    if args.size > 1
      replacement_hash = {}
      args[1..-1].each do |arg|
        replacement_hash.merge!(arg)
      end

      tree = tree.transform{|subtree|
        if subtree.node_type == :call
          next replacement_hash[subtree[2]]
        elsif subtree.node_type == :lvar
          next replacement_hash[subtree[1]]
        else
          next nil
        end
      }    
    end 
    
    tree
  else
    sexp = FastRuby::FastRubySexp.new
    args.each {|subtree| sexp << subtree}
    sexp
  end
end

#lvar_type(*x) ⇒ Object



35
# File 'lib/fastruby/object.rb', line 35

def lvar_type(*x); end