public object GetProperty(string name) { if (properties.ContainsKey(name)) { return(properties[name]); } BuiltinFunction method = GetMethod(name); if (method != null) { return(method.Bind(this, superclass)); } if (superclass != null) { BuiltinFunction superMethod = superclass.GetMethod(name); if (superMethod != null) { return(method.Bind(this, superclass)); } } throw new RuntimeException($"Object <{ ToString() } > has no property <{name}>"); }
public BuiltinFunction GetMethod(string name) => methods.ContainsKey(name) ? methods[name] : superclass?.GetMethod(name);