Class: Idl::ReturnStatementAst

Inherits:
AstNode
  • Object
show all
Includes:
Returns
Defined in:
lib/idl/ast.rb

Overview

represents a function return statement

for example:

return 5;
return X[rs1] + 1;

Instance Method Summary collapse

Constructor Details

#initialize(input, interval, return_expression) ⇒ ReturnStatementAst

Returns a new instance of ReturnStatementAst.



3905
3906
3907
# File 'lib/idl/ast.rb', line 3905

def initialize(input, interval, return_expression)
  super(input, interval, [return_expression])
end

Instance Method Details

#enclosing_functionObject



3934
3935
3936
# File 'lib/idl/ast.rb', line 3934

def enclosing_function
  return_expression.enclosing_function
end

#expected_return_type(symtab) ⇒ Type

Returns The expected return type (as defined by the encolsing function).

Returns:

  • (Type)

    The expected return type (as defined by the encolsing function)



3920
3921
3922
# File 'lib/idl/ast.rb', line 3920

def expected_return_type(symtab)
  return_expression.expected_return_type(symtab)
end

#return_expressionObject



3901
3902
3903
# File 'lib/idl/ast.rb', line 3901

def return_expression
  @children[0]
end

#return_type(symtab) ⇒ Object



3915
3916
3917
# File 'lib/idl/ast.rb', line 3915

def return_type(symtab)
  return_expression.retrun_type(symtab)
end

#return_types(symtab) ⇒ Array<Type>

Returns List of actual return types.

Returns:

  • (Array<Type>)

    List of actual return types



3910
3911
3912
# File 'lib/idl/ast.rb', line 3910

def return_types(symtab)
  return_expression.return_types(symtab)
end

#return_value(symtab) ⇒ Object



3939
3940
3941
# File 'lib/idl/ast.rb', line 3939

def return_value(symtab)
  return_expression.return_value(symtab)
end

#return_value_nodesArray<AstNode>

Returns List of return value nodes.

Returns:

  • (Array<AstNode>)

    List of return value nodes



3930
3931
3932
# File 'lib/idl/ast.rb', line 3930

def return_value_nodes
  return_expression.return_value_nodes
end

#return_values(symtab) ⇒ Object



3944
3945
3946
# File 'lib/idl/ast.rb', line 3944

def return_values(symtab)
  return_expression.return_values(symtab)
end

#to_idlObject



3948
# File 'lib/idl/ast.rb', line 3948

def to_idl = "#{return_expression.to_idl};"

#type_check(symtab) ⇒ void

This method returns an undefined value.

type check this node and all children

Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError

Parameters:

Raises:



3925
3926
3927
# File 'lib/idl/ast.rb', line 3925

def type_check(symtab)
  return_expression.type_check(symtab)
end