public static GlobalVariable newUndefined(Ruby runtime, String name) { GlobalVariable variable = new GlobalVariable(null, Scope.GLOBAL); variable.setAccessor(new UndefinedAccessor(runtime, variable, name)); return variable; }
public void setTraceVar(String name, RubyProc proc) { assert name != null; assert name.startsWith("$"); GlobalVariable variable = createIfNotDefined(name); variable.addTrace(proc); }
public static void setGlobalUncached(GlobalVariable variable, IRubyObject value) throws Throwable { // FIXME: duplicated logic from GlobalVariables.set variable.getAccessor().setValue(value); variable.trace(value); variable.invalidate(); }
variable.getScope() != GlobalVariable.Scope.GLOBAL || RubyGlobal.UNCACHED_GLOBALS.contains(site.name())) { Invalidator invalidator = variable.getInvalidator(); IRubyObject value = variable.getAccessor().getValue();
public boolean isDefined(String name) { assert name != null; assert name.startsWith("$"); GlobalVariable variable = globalVariables.get(name); return variable != null && !(variable.getAccessor() instanceof UndefinedAccessor); }
public void define(String name, IAccessor accessor, GlobalVariable.Scope scope) { assert name != null; assert accessor != null; assert name.startsWith("$"); globalVariables.put(name, new GlobalVariable(accessor, scope)); }
public boolean untraceVar(String name, IRubyObject command) { assert name != null; assert name.startsWith("$"); if (isDefined(name)) { GlobalVariable variable = globalVariables.get(name); return variable.removeTrace(command); } return false; }
public void untraceVar(String name) { assert name != null; assert name.startsWith("$"); if (isDefined(name)) { GlobalVariable variable = (GlobalVariable)globalVariables.get(name); variable.removeTraces(); } }
private GlobalVariable createIfNotDefined(String name) { GlobalVariable variable = globalVariables.get(name); if (variable == null) { variable = GlobalVariable.newUndefined(runtime, name); globalVariables.put(name, variable); } return variable; }
/** Creates a new global variable which links to * the oldName global variable. * * <b>WANRING</b> we are already using the 1.7.1 behaviour. */ public void alias(String name, String oldName) { assert name != null; assert oldName != null; assert name.startsWith("$"); assert oldName.startsWith("$"); GlobalVariable oldVariable = createIfNotDefined(oldName); GlobalVariable variable = globalVariables.get(name); if (variable != null && oldVariable != variable && variable.isTracing()) { throw RaiseException.from(runtime, runtime.getRuntimeError(), "can't alias in tracer"); } globalVariables.put(name, oldVariable); }
variable.getScope() != GlobalVariable.Scope.GLOBAL || RubyGlobal.UNCACHED_GLOBALS.contains(site.name())) { Invalidator invalidator = variable.getInvalidator(); IRubyObject value = variable.getAccessor().getValue();
public boolean isDefined(String name) { assert name != null; assert name.startsWith("$"); GlobalVariable variable = globalVariables.get(name); return variable != null && !(variable.getAccessor() instanceof UndefinedAccessor); }
public void define(String name, IAccessor accessor, GlobalVariable.Scope scope) { assert name != null; assert accessor != null; assert name.startsWith("$"); globalVariables.put(name, new GlobalVariable(accessor, scope)); }
public boolean untraceVar(String name, IRubyObject command) { assert name != null; assert name.startsWith("$"); if (isDefined(name)) { GlobalVariable variable = (GlobalVariable)globalVariables.get(name); return variable.removeTrace(command); } return false; }
public void untraceVar(String name) { assert name != null; assert name.startsWith("$"); if (isDefined(name)) { GlobalVariable variable = globalVariables.get(name); variable.removeTraces(); } }
private GlobalVariable createIfNotDefined(String name) { GlobalVariable variable = globalVariables.get(name); if (variable == null) { variable = GlobalVariable.newUndefined(runtime, name); globalVariables.put(name, variable); } return variable; }
/** Creates a new global variable which links to * the oldName global variable. * * <b>WANRING</b> we are already using the 1.7.1 behaviour. */ public void alias(String name, String oldName) { assert name != null; assert oldName != null; assert name.startsWith("$"); assert oldName.startsWith("$"); GlobalVariable oldVariable = createIfNotDefined(oldName); GlobalVariable variable = (GlobalVariable)globalVariables.get(name); if (variable != null && oldVariable != variable && variable.isTracing()) { throw new RaiseException(runtime, runtime.getRuntimeError(), "can't alias in tracer", false); } globalVariables.put(name, oldVariable); }
public static void setGlobalUncached(GlobalVariable variable, IRubyObject value) throws Throwable { // FIXME: duplicated logic from GlobalVariables.set variable.getAccessor().setValue(value); variable.trace(value); variable.invalidate(); }
variable.getScope() != GlobalVariable.Scope.GLOBAL) { Invalidator invalidator = variable.getInvalidator(); IRubyObject value = variable.getAccessor().getValue();
public static GlobalVariable newUndefined(Ruby runtime, String name) { GlobalVariable variable = new GlobalVariable(null, Scope.GLOBAL); variable.setAccessor(new UndefinedAccessor(runtime, variable, name)); return variable; }