Class: Stone::AST::ProgramUnit::TopFunction
- Inherits:
-
Object
- Object
- Stone::AST::ProgramUnit::TopFunction
- Includes:
- TwoPhaseProcessing
- Defined in:
- lib/stone/ast/program_unit/top_function.rb
Instance Method Summary collapse
- #generate(mod, scope = Stone::Scope.top_level) ⇒ Object
-
#initialize(children) ⇒ TopFunction
constructor
A new instance of TopFunction.
Constructor Details
#initialize(children) ⇒ TopFunction
Returns a new instance of TopFunction.
13 14 15 16 |
# File 'lib/stone/ast/program_unit/top_function.rb', line 13 def initialize(children) @children = children @mod = nil end |
Instance Method Details
#generate(mod, scope = Stone::Scope.top_level) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/stone/ast/program_unit/top_function.rb', line 18 def generate(mod, scope = Stone::Scope.top_level) @mod = mod @scope = scope register_all_types(mod, scope) mod.functions.add("__top__", function_type) { |func| build_function_body(func, mod, scope) } end |