Skip to content
Permalink
Browse files

Fixed #645 -- corrected defined? ::Constant

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 20, 2013
1 parent 3d44303 commit 836fff9b97e6f3ad080f6858928e44bbedb3097f
Showing with 7 additions and 0 deletions.
  1. +6 −0 tests/test_interpreter.py
  2. +1 −0 topaz/ast.py
@@ -1147,6 +1147,12 @@ def b
""")
assert self.unwrap(space, w_res) == ["super", None]

def test_defined_unscoped_constant(self, space):
w_res = space.execute("return defined? ::Foobar")
assert w_res is space.w_nil
w_res = space.execute("return defined? ::Fixnum")
assert self.unwrap(space, w_res) == "constant"

def test_match(self, space):
w_res = space.execute("return 3 =~ nil")
assert self.unwrap(space, w_res) is None
@@ -932,6 +932,7 @@ def compile_store(self, ctx):
ctx.emit(consts.STORE_CONSTANT, ctx.create_symbol_const(self.name))

def compile_defined(self, ctx):
self.compile_receiver(ctx)
ctx.emit(consts.DEFINED_CONSTANT, ctx.create_symbol_const(self.name))


0 comments on commit 836fff9

Please sign in to comment.