Module: Ionize::Php::Translate::TermStatements

Included in:
Statements
Defined in:
lib/ionize/translate/term_statements.rb

Instance Method Summary collapse

Instance Method Details

#handle_reference_term(node) ⇒ Object



56
57
58
59
60
# File 'lib/ionize/translate/term_statements.rb', line 56

def handle_reference_term(node)
  # For now, I say screw references..
  transform(node.rest)
  # TODO: But we might change this in the future.. Who knows.
end

#handle_term_and_expr(node) ⇒ Object



22
23
24
25
# File 'lib/ionize/translate/term_statements.rb', line 22

def handle_term_and_expr(node)
  term, op, expr = *node
  [:and, transform(term), transform(expr)]
end

#handle_term_and_expr_with_and(node) ⇒ Object



27
28
29
30
# File 'lib/ionize/translate/term_statements.rb', line 27

def handle_term_and_expr_with_and(node)
  term, op, expr = *node
  [:and, transform(term), transform(expr)]
end

#handle_term_array_append(node) ⇒ Object



13
14
15
# File 'lib/ionize/translate/term_statements.rb', line 13

def handle_term_array_append(node)

end

#handle_term_array_assign(node) ⇒ Object



17
18
19
20
# File 'lib/ionize/translate/term_statements.rb', line 17

def handle_term_array_assign(node)
  term, lb, attr, rb, eq, expr = *node
  [:attrasgn, transform(term), :[]=, [:array, transform(attr), transform(expr)]]
end

#handle_term_assign(node) ⇒ Object



9
10
11
# File 'lib/ionize/translate/term_statements.rb', line 9

def handle_term_assign(node)
  Rewrites.new(self).handle_term_assign(node)
end

#handle_term_error_guard(node) ⇒ Object



5
6
7
# File 'lib/ionize/translate/term_statements.rb', line 5

def handle_term_error_guard(node)
  [:rescue, transform(node.second), [:resbody, nil, [:nil]]]
end

#handle_term_hashs_to_expr(node) ⇒ Object



52
53
54
# File 'lib/ionize/translate/term_statements.rb', line 52

def handle_term_hashs_to_expr(node)
  [:hash, transform(node.first), transform(node.third)]
end

#handle_term_not_equals_expr(node) ⇒ Object



47
48
49
50
# File 'lib/ionize/translate/term_statements.rb', line 47

def handle_term_not_equals_expr(node)
  term, op, expr = *node
  [:not, [:call, transform(term), :==, [:array, transform(expr)]]]
end

#handle_term_op_expr(node) ⇒ Object



32
33
34
35
# File 'lib/ionize/translate/term_statements.rb', line 32

def handle_term_op_expr(node)
  term, op, expr = *node
  [:call, transform(term), transform(op), [:array, transform(expr)]]
end

#handle_term_or_expr(node) ⇒ Object



37
38
39
40
# File 'lib/ionize/translate/term_statements.rb', line 37

def handle_term_or_expr(node)
  term, op, expr = *node
  [:or, transform(term), transform(expr)]
end

#handle_term_or_expr_with_or(node) ⇒ Object



42
43
44
45
# File 'lib/ionize/translate/term_statements.rb', line 42

def handle_term_or_expr_with_or(node)
  term, op, expr = *node
  [:or, transform(term), transform(expr)]
end