// dynamic dispatch to "const_missing" if not found public object ResolveConstant(bool autoload, string /*!*/ name) { object result; if (TryResolveConstant(autoload, name, out result)) { return(result); } RubyUtils.CheckConstantName(name); return(RubySites.ModuleConstMissing(RubyContext, GetInnerMostModule(), name)); }
public static object GetConstant(RubyScope /*!*/ scope, RubyModule /*!*/ owner, string /*!*/ name, bool lookupObject) { Assert.NotNull(scope, owner, name); object result; if (owner.TryResolveConstant(scope.GlobalScope, name, out result)) { return(result); } RubyClass objectClass = owner.Context.ObjectClass; if (owner != objectClass && lookupObject && objectClass.TryResolveConstant(scope.GlobalScope, name, out result)) { return(result); } CheckConstantName(name); return(RubySites.ModuleConstMissing(scope.RubyContext, owner, name)); }