Class: CodeTools::AST::And
- Defined in:
- lib/rubinius/code/ast/operators.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g, use_gif = true) ⇒ Object
- #defined(g) ⇒ Object
-
#initialize(line, left, right) ⇒ And
constructor
A new instance of And.
- #sexp_name ⇒ Object
- #to_sexp ⇒ Object
Methods inherited from Node
#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, left, right) ⇒ And
Returns a new instance of And.
8 9 10 11 12 |
# File 'lib/rubinius/code/ast/operators.rb', line 8 def initialize(line, left, right) @line = line @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
6 7 8 |
# File 'lib/rubinius/code/ast/operators.rb', line 6 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
6 7 8 |
# File 'lib/rubinius/code/ast/operators.rb', line 6 def right @right end |
Instance Method Details
#bytecode(g, use_gif = true) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubinius/code/ast/operators.rb', line 14 def bytecode(g, use_gif=true) @left.bytecode(g) g.dup lbl = g.new_label if use_gif g.goto_if_false lbl else g.goto_if_true lbl end g.pop @right.bytecode(g) lbl.set! end |
#defined(g) ⇒ Object
30 31 32 33 |
# File 'lib/rubinius/code/ast/operators.rb', line 30 def defined(g) g.push_literal "expression" g.string_dup end |
#sexp_name ⇒ Object
35 36 37 |
# File 'lib/rubinius/code/ast/operators.rb', line 35 def sexp_name :and end |
#to_sexp ⇒ Object
39 40 41 |
# File 'lib/rubinius/code/ast/operators.rb', line 39 def to_sexp [sexp_name, @left.to_sexp, @right.to_sexp] end |