Skip to content
Permalink
Browse files

Use default visibility

  • Loading branch information
alex committed Jun 16, 2013
1 parent a09823c commit ccb731272b2024ff8a4f98ba99c417e3f3ee683f
Showing with 9 additions and 5 deletions.
  1. +2 −0 topaz/frame.py
  2. +1 −1 topaz/interpreter.py
  3. +2 −1 topaz/objects/functionobject.py
  4. +2 −1 topaz/objects/moduleobject.py
  5. +2 −2 topaz/objspace.py
@@ -2,6 +2,7 @@

from topaz.closure import LocalCell
from topaz.objects.arrayobject import W_ArrayObject
from topaz.objects.functionobject import W_FunctionObject


class BaseFrame(object):
@@ -33,6 +34,7 @@ def __init__(self, bytecode, w_self, lexical_scope, block, parent_interp,
self.lexical_scope = lexical_scope
self.block = block
self.parent_interp = parent_interp
self.visibility = W_FunctionObject.PUBLIC
self.lastblock = None

def _set_arg(self, space, pos, w_value):
@@ -332,7 +332,7 @@ def BUILD_RANGE_EXCLUSIVE(self, space, bytecode, frame, pc):
def BUILD_FUNCTION(self, space, bytecode, frame, pc):
w_code = frame.pop()
w_name = frame.pop()
w_func = space.newfunction(w_name, w_code, frame.lexical_scope)
w_func = space.newfunction(w_name, w_code, frame.lexical_scope, frame.visibility)
frame.push(w_func)

@jit.unroll_safe
@@ -1,6 +1,5 @@
import copy

from topaz.frame import BuiltinFrame
from topaz.objects.objectobject import W_BaseObject


@@ -71,6 +70,8 @@ def __deepcopy__(self, memo):
return obj

def call(self, space, w_receiver, args_w, block):
from topaz.frame import BuiltinFrame

frame = BuiltinFrame(self.name)
ec = space.getexecutioncontext()
ec.invoke_trace_proc(space, "c-call", self.name, self.w_class.name)
@@ -320,7 +320,8 @@ def set_visibility(self, space, names_w, visibility):
self.set_default_visibility(space, visibility)

def set_default_visibility(self, space, visibility):
pass
frame = space.getexecutioncontext().gettoprubyframe()
frame.visibility = visibility

def set_method_visibility(self, space, name, visibility):
w_method = self.find_method(space, name)
@@ -404,10 +404,10 @@ def newclass(self, name, superclass, is_singleton=False, w_scope=None, attached=
complete_name = self.buildname(name, w_scope)
return W_ClassObject(self, complete_name, superclass, is_singleton=is_singleton, attached=attached)

def newfunction(self, w_name, w_code, lexical_scope):
def newfunction(self, w_name, w_code, lexical_scope, visibility):
name = self.symbol_w(w_name)
assert isinstance(w_code, W_CodeObject)
return W_UserFunction(name, w_code, lexical_scope)
return W_UserFunction(name, w_code, lexical_scope, visibility)

def newmethod(self, name, w_cls):
w_function = w_cls.find_method(self, name)

0 comments on commit ccb7312

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