public LispResolvedSymbol ResolveSymbol(LispUnresolvedSymbol symbol) { // first try to resolve against one of the inherited packages LispResolvedSymbol resolvedSymbol = null; foreach (var package in _inheritedPackages) { var inheritedValue = package.GetValue(symbol.LocalName); if (inheritedValue != null) { // TODO: fix calculation of `isPublic` resolvedSymbol = new LispResolvedSymbol(package.Name, symbol.LocalName, isPublic: true); break; } } // otherwise resolve to this package // TODO: fix calculation of `isPublic` if (resolvedSymbol == null) { resolvedSymbol = new LispResolvedSymbol(Name, symbol.LocalName, isPublic: true); } resolvedSymbol.Parent = symbol.Parent; resolvedSymbol.SourceLocation = symbol.SourceLocation; return(resolvedSymbol); }
public override LispObject GetValue(string name) { var symbol = new LispResolvedSymbol(Name, name, isPublic: true); SetValue(name, symbol); return(base.GetValue(name)); }
public virtual LispObject GetValue(LispResolvedSymbol symbol) { if (_values.TryGetValue(symbol.Value, out var value)) { return(value); } return(Parent?.GetValue(symbol)); }
public bool TryGetBoundValue(LispResolvedSymbol symbol, out LispObject value) { if (_parsedBindings.TryGetValue(symbol.Value, out value)) { return(true); } return(false); }
public virtual void DeleteValue(LispResolvedSymbol symbol) { _values.Remove(symbol.Value); }
public TObject GetValue <TObject>(LispResolvedSymbol symbol) where TObject : LispObject { return((TObject)GetValue(symbol)); }
public virtual void SetValue(LispResolvedSymbol symbol, LispObject value) { _values[symbol.Value] = value; Root.OnValueSet(symbol, value, this); }
internal void SetValueInParentScope(LispResolvedSymbol symbol, LispObject value) { var target = Parent ?? this; target.SetValue(symbol, value); }
protected LispStackFrame(LispResolvedSymbol functionSymbol, LispStackFrame parent) { FunctionSymbol = functionSymbol; Parent = parent; Depth = (Parent?.Depth ?? LispRootStackFrame.RootStackDepth) + 1; }
public LispValueSetEventArgs(LispResolvedSymbol symbol, LispObject value, LispStackFrame stackFrame) { Symbol = symbol; Value = value; StackFrame = stackFrame; }