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