Skip to content
Permalink
Browse files

Expose ivars and cvars on classes.

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 17, 2013
1 parent 7db807b commit 9192e7307bfdeb6ee36a8268c1ff1df12d460616
Showing with 11 additions and 6 deletions.
  1. +0 −5 spec/tags/language/class_tags.txt
  2. +0 −1 topaz.mspec
  3. +3 −0 topaz/celldict.py
  4. +8 −0 topaz/objects/classobject.py
@@ -1,9 +1,4 @@
fails:A class definition has no class variables
fails:A class definition raises a TypeError if inheriting from a metaclass
fails:A class definition allows the declaration of class variables in the body
fails:A class definition stores instance variables defined in the class body in the class object
fails:A class definition allows the declaration of class variables in a class method
fails:A class definition allows the definition of class-level instance variables in a class method
fails:A class definition allows the declaration of class variables in an instance method
fails:A class definition extending an object (sclass) can use return to cause the enclosing method to return
fails:Reopening a class raises a TypeError when superclasses mismatch
@@ -128,7 +128,6 @@ class MSpecScript
"^#{Rubyspec}/language/BEGIN_spec.rb",
"^#{Rubyspec}/language/alias_spec.rb",
"^#{Rubyspec}/language/break_spec.rb",
"^#{Rubyspec}/language/class_spec.rb",
"^#{Rubyspec}/language/def_spec.rb",
"^#{Rubyspec}/language/defined_spec.rb",
"^#{Rubyspec}/language/or_spec.rb",
@@ -68,6 +68,9 @@ def __deepcopy__(self, memo):
c.version = copy.deepcopy(self.version, memo)
return c

def __iter__(self):
return iter(self.values)

def mutated(self):
self.version = VersionTag()

@@ -99,3 +99,11 @@ def method_allocate(self, space, args_w):
@classdef.method("superclass")
def method_superclass(self, space):
return self.superclass if self.superclass is not None else space.w_nil

@classdef.method("class_variables")
def method_class_variables(self, space):
return space.newarray([space.newsymbol(cvar) for cvar in self.class_variables])

@classdef.method("instance_variables")
def method_instance_variables(self, space):
return space.newarray([space.newsymbol(ivar) for ivar in self.instance_variables])

0 comments on commit 9192e73

Please sign in to comment.
You can’t perform that action at this time.