rubyx/lib/soml/compiler/field_def.rb

16 lines
506 B
Ruby
Raw Normal View History

2015-10-23 13:22:55 +02:00
module Soml
2015-09-20 15:30:07 +02:00
Compiler.class_eval do
include AST::Sexp
2015-09-20 15:30:07 +02:00
def on_field_def statement
reset_regs # field_def is a statement, no return and all regs
2015-10-16 12:12:52 +02:00
#puts statement.inspect
type , name , value = *statement
2015-11-02 20:27:37 +01:00
@method.ensure_local( name.first, type ) unless( @method.has_arg(name.first))
# if there is a value assigned, process it as am assignemnt statement (kind of call on_assign)
2015-11-02 20:27:37 +01:00
process( s(:assignment , name , value ) ) if value
return nil
2015-09-20 15:30:07 +02:00
end
end
end