update reader and implement class field
This commit is contained in:
parent
b99b392481
commit
6bdbfcde60
@ -12,7 +12,7 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/salama/salama-reader.git
|
remote: git://github.com/salama/salama-reader.git
|
||||||
revision: e8bc570d2530e501a08ed35eb5b6fac26dc78309
|
revision: 34691f36d13f68d2c39cea266f26ea201bc78bb6
|
||||||
specs:
|
specs:
|
||||||
salama-reader (0.2.0)
|
salama-reader (0.2.0)
|
||||||
ast (~> 2.1.0)
|
ast (~> 2.1.0)
|
||||||
|
22
lib/bosl/compiler/class_field.rb
Normal file
22
lib/bosl/compiler/class_field.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user