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