edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;C445606 File: Marshal.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;C445606 (server) 5/27/2008 6:26 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;RubyMarshalFix2 @@ -658,12 +658,8 @@ } object/*!*/ ReadClassOrModule(char typeFlag, SymbolId name) { - object obj; - RubyModule result = null; - if (_rubyContext.TryResolveConstant(_context, name, out obj)) { - result = (obj as RubyModule); - } - if (result == null) { + RubyModule result; + if (!_rubyContext.TryGetModule(name, out result)) { throw RubyExceptions.CreateArgumentError( String.Format("undefined class/module {0}", SymbolTable.IdToString(name))); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C447029 File: RubyExecutionContext.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C447029 (server) 5/27/2008 6:27 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;RubyMarshalFix2 @@ -911,6 +911,33 @@ return innerMostModule != null && innerMostModule.TryResolveConstant(name, out result); } + public bool TryGetModule(SymbolId name, out RubyModule result) { + result = _objectClass; + string moduleName = SymbolTable.IdToString(name); + int pos = 0; + while (true) { + int pos2 = moduleName.IndexOf("::", pos); + string partialName; + if (pos2 < 0) { + partialName = moduleName.Substring(pos); + } else { + partialName = moduleName.Substring(pos, pos2 - pos); + pos = pos2 + 2; + } + object tmp; + if (!result.TryResolveConstant(SymbolTable.StringToId(partialName), out tmp)) { + result = null; + return false; + } + result = (tmp as RubyModule); + if (result == null) { + return false; + } else if (pos2 < 0) { + return true; + } + } + } + public SymbolId[]/*!*/ GetInstanceVariableNames(object obj) { RubyInstanceData data = TryGetInstanceData(obj); return (data != null) ? data.GetInstanceVariableNames() : SymbolId.EmptySymbols; ===================================================================