Module: Ionize::Php::Translate::IfStatements

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

Instance Method Summary collapse

Instance Method Details

#handle_if_else_statement1(node) ⇒ Object



26
27
28
29
# File 'lib/ionize/translate/if_statements.rb', line 26

def handle_if_else_statement1(node)
  debug "If else statement1 #{node.inspect}"
  [:if, transform(node.third), transform(node[4]).to_block, transform(node[6]).to_block]
end

#handle_if_else_statement_b(node) ⇒ Object



31
32
33
# File 'lib/ionize/translate/if_statements.rb', line 31

def handle_if_else_statement_b(node)
  [:if, transform(node.third), transform(node[5]).to_block, transform(node[9]).to_block]
end

#handle_if_else_statement_b1(node) ⇒ Object



35
36
37
38
# File 'lib/ionize/translate/if_statements.rb', line 35

def handle_if_else_statement_b1(node)
  debug "If else statement b1 #{node.inspect}"
  [:if, transform(node.third), transform(node[5]).to_block, transform(node[8]).to_block]
end

#handle_if_statement0(node) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ionize/translate/if_statements.rb', line 5

def handle_if_statement0(node)
  debug "If statement0 #{node.inspect}"      
  condition = transform(node.third)
  body      = transform(node[4]).to_block
  if condition.first == :not
      [:if, condition.second, nil, body]
  else
    [:if, condition, body, nil]
  end
end

#handle_if_statement_b(node) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/ionize/translate/if_statements.rb', line 16

def handle_if_statement_b(node)
  condition = transform(node.third)
  body      = transform(node[5]).to_block
  if condition.first == :not
      [:if, condition.second, nil, body]
  else
    [:if, condition, body, nil]
  end
end