Class: BlocklyInterpreter::CoreBlocks::ProceduresDefReturnBlock::DSLMethods::ProceduresDefReturnBlockBuilder

Inherits:
DSL::BlockBuilder
  • Object
show all
Defined in:
lib/blockly_interpreter/core_blocks/procedures_def_return_block.rb

Instance Attribute Summary collapse

Attributes inherited from DSL::BlockBuilder

#block_type, #comment, #comment_pinned, #fields, #is_shadow, #mutation_attrs, #mutation_child_procs, #statements, #values, #x, #y

Instance Method Summary collapse

Methods inherited from DSL::BlockBuilder

#build_subblock, #comment_to_xml, #field, #field_to_xml, #mutation_attr, #mutation_child, #mutations_to_xml, #set_comment, #set_position!, #shadow!, #statement, #subblock_to_xml, #tag_name, #to_xml, #value

Constructor Details

#initialize(block_type, procedure_name, arg_names) ⇒ ProceduresDefReturnBlockBuilder

Returns a new instance of ProceduresDefReturnBlockBuilder.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/blockly_interpreter/core_blocks/procedures_def_return_block.rb', line 31

def initialize(block_type, procedure_name, arg_names)
  super(block_type)

  field :NAME, procedure_name

  arg_names.each do |arg_name|
    mutation_child :arg do |child|
      child['name'] = arg_name
    end
  end
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



29
30
31
# File 'lib/blockly_interpreter/core_blocks/procedures_def_return_block.rb', line 29

def stack
  @stack
end

Instance Method Details

#body(&proc) ⇒ Object



43
44
45
# File 'lib/blockly_interpreter/core_blocks/procedures_def_return_block.rb', line 43

def body(&proc)
  statement :STACK, &proc
end

#return_value(&proc) ⇒ Object



47
48
49
# File 'lib/blockly_interpreter/core_blocks/procedures_def_return_block.rb', line 47

def return_value(&proc)
  value :RETURN, &proc
end