diff --git a/Gemfile.lock b/Gemfile.lock index 39efa2dc..1f8d08e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/lib/bosl/compiler/class_field.rb b/lib/bosl/compiler/class_field.rb new file mode 100644 index 00000000..3eacc1d0 --- /dev/null +++ b/lib/bosl/compiler/class_field.rb @@ -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