update reader and implement class field

This commit is contained in:
Torsten Ruger 2015-09-27 12:58:54 +03:00
parent b99b392481
commit 6bdbfcde60
2 changed files with 23 additions and 1 deletions

View File

@ -12,7 +12,7 @@ GIT
GIT
remote: git://github.com/salama/salama-reader.git
revision: e8bc570d2530e501a08ed35eb5b6fac26dc78309
revision: 34691f36d13f68d2c39cea266f26ea201bc78bb6
specs:
salama-reader (0.2.0)
ast (~> 2.1.0)

View File

@ -0,0 +1,22 @@
module Bosl
Compiler.class_eval do
def on_class_field expression
puts expression.inspect
type , name , value = *expression
for_class = self.method.for_class
index = for_class.object_layout.variable_index(name)
raise "class field already defined:#{name} for class #{for_class.name}" if index
puts "Define field #{name} on class #{for_class.name}"
index = for_class.object_layout.add_instance_variable( name ) #TODO need typing
if value
value = process( value )
raise "value #{value}" #tbc
end
Virtual::Return.new( index )
end
end
end