Class: CodeTools::AST::Match
- Defined in:
- lib/rubinius/code/ast/control_flow.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, pattern, flags) ⇒ Match
constructor
A new instance of Match.
- #to_sexp ⇒ Object
Methods inherited from Node
#ascii_graph, #attributes, #children, #defined, 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, pattern, flags) ⇒ Match
Returns a new instance of Match.
444 445 446 447 |
# File 'lib/rubinius/code/ast/control_flow.rb', line 444 def initialize(line, pattern, flags) @line = line @pattern = RegexLiteral.new line, pattern, flags end |
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
442 443 444 |
# File 'lib/rubinius/code/ast/control_flow.rb', line 442 def pattern @pattern end |
Instance Method Details
#bytecode(g) ⇒ Object
449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/rubinius/code/ast/control_flow.rb', line 449 def bytecode(g) pos(g) g.push_rubinius g.find_const :Globals g.push_literal :$_ g.send :[], 1 @pattern.bytecode(g) g.send :=~, 1 end |
#to_sexp ⇒ Object
462 463 464 |
# File 'lib/rubinius/code/ast/control_flow.rb', line 462 def to_sexp [:match, @pattern.to_sexp] end |