Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed #645 -- corrected defined? ::Constant
- Loading branch information
Showing
with
7 additions
and
0 deletions.
-
+6
−0
tests/test_interpreter.py
-
+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)) |
|
|
|
|
|
|
|
|