trying to get function calls to work (but will have to rework regeister handling)

This commit is contained in:
Torsten Ruger
2014-05-10 15:24:56 +03:00
parent 7d69132d90
commit 79a28ac5fa
9 changed files with 25 additions and 7 deletions

View File

@ -2,7 +2,7 @@ module Ast
class FunctionExpression < Expression
attr_reader :name, :params, :block
def initialize name, params, block
@name, @params, @block = name, params, block
@name, @params, @block = name.to_sym, params, block
end
def attributes
[:name, :params, :block]
@ -16,6 +16,7 @@ module Ast
def compile context
args = params.collect{|p| Vm::Value.type p.name }
function = Vm::Function.new(name ,args )
context.program.add_function function
parent_locals = context.locals
context.locals = {}
block.each do |b|