edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/ClassInitGenerator/Libraries/LibraryDef.cs;C669880 File: LibraryDef.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/ClassInitGenerator/Libraries/LibraryDef.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/ClassInitGenerator/Libraries/LibraryDef.cs;MoreSites4 @@ -582,7 +582,7 @@ LogMethodError("CodeContext is obsolete use RubyContext instead.", methodDef, overload); } - if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(SiteLocalStorage<>)) { + if (type.IsSubclassOf(typeof(SiteLocalStorage))) { if (hasSelf || hasContext || hasBlock) { LogMethodError("SiteLocalStorage must precede all other parameters", methodDef, overload); } =================================================================== add: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Experimental/bounds.rb File: bounds.rb =================================================================== --- [no source file] +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Experimental/bounds.rb;MoreSites4 @@ -1,0 +1,27 @@ +class R < Range + def initialize + super(0,0) + end + + def begin; p 'x'; 1; end + def end; p 'x';2; end + def exclude_end?; p 'x';false; end +end + +a = [1,2,3,4] +p a[R.new] + +x = "1234" +x.slice!(R.new) +p x + +p "1234".slice(R.new) + +x = "1234" +x[R.new] = 'x' +p x + +s = Struct.new(:a,:b,:c,:d)[1,2,3,4] +p s.values_at(R.new) + + =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;C669880 File: RubyTests.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;MoreSites4 @@ -83,7 +83,8 @@ Strings6, Strings7, Strings8, - // TODO: Strings9, + ToSConversion1, + ToSConversion2, Regex1, Regex2, =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/AssertTokenizer.cs;C667392 File: AssertTokenizer.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/AssertTokenizer.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/AssertTokenizer.cs;MoreSites4 @@ -52,8 +52,10 @@ public AssertTokenizer/*!*/ Load(object/*!*/ source) { // source: byte[] or string Tests.Assert(_log.Errors.Count == 0, "Previous test case reported unexpected error/warning(s)"); - _tokenizer = new Tokenizer(false, _log, DummyVariableResolver.AllMethodNames); - _tokenizer.Compatibility = _context.RubyOptions.Compatibility; + _tokenizer = new Tokenizer(false, DummyVariableResolver.AllMethodNames) { + ErrorSink = _log, + Compatibility = _context.RubyOptions.Compatibility + }; SourceUnit sourceUnit; byte[] binarySource = source as byte[]; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/StringTests.cs;C651054 File: StringTests.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/StringTests.cs;C651054 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/StringTests.cs;MoreSites4 @@ -184,8 +184,7 @@ /// /// Embedded string does call "to_s" w/o calling "respond_to?" first. /// - public void Strings9() { - // TODO: + public void ToSConversion1() { AssertOutput(delegate() { CompilerTest(@" class X @@ -205,6 +204,29 @@ "); } + public void ToSConversion2() { + AssertOutput(delegate() { + CompilerTest(@" +class NilClass + def to_s; 'NULL1'; end + puts ""#{nil}"" + def to_s; 'NULL2'; end + puts ""#{nil}"" +end + +class SubString < String + def to_s; 'XXX'; end + puts ""#{new 'SUB'}"" +end +"); + }, @" +NULL1 +NULL2 +SUB +"); + } + + } } \ No newline at end of file =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C669880 File: Initializers.Generated.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;MoreSites4 @@ -84,7 +84,7 @@ ExtendModule(typeof(System.IComparable), new System.Action(LoadSystem__IComparable_Instance), null, new IronRuby.Builtins.RubyModule[] {def30, }); DefineGlobalClass("Array", typeof(IronRuby.Builtins.RubyArray), false, Context.ObjectClass, new System.Action(LoadArray_Instance), new System.Action(LoadArray_Class), new IronRuby.Builtins.RubyModule[] {def21, }, new System.Delegate[] { new System.Func(IronRuby.Builtins.ArrayOps.CreateArray), - new System.Func(IronRuby.Builtins.ArrayOps.CreateArray), + new System.Func, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyClass, System.Object, System.Object>(IronRuby.Builtins.ArrayOps.CreateArray), new System.Func(IronRuby.Builtins.ArrayOps.CreateArray), }); DefineGlobalClass("Binding", typeof(IronRuby.Builtins.Binding), false, Context.ObjectClass, null, null, IronRuby.Builtins.RubyModule.EmptyArray, null); @@ -100,7 +100,6 @@ #if !SILVERLIGHT IronRuby.Builtins.RubyClass def20 = DefineClass("File::Stat", typeof(System.IO.FileSystemInfo), false, Context.ObjectClass, new System.Action(LoadFile__Stat_Instance), null, new IronRuby.Builtins.RubyModule[] {def30, }, new System.Delegate[] { new System.Func(IronRuby.Builtins.RubyFileOps.RubyStatOps.Create), - new System.Func(IronRuby.Builtins.RubyFileOps.RubyStatOps.Create), }); #endif DefineGlobalClass("FileTest", typeof(IronRuby.Builtins.FileTestOps), true, Context.ObjectClass, null, new System.Action(LoadFileTest_Class), IronRuby.Builtins.RubyModule.EmptyArray, null); @@ -125,7 +124,7 @@ IronRuby.Builtins.RubyClass def19 = DefineClass("Process::Status", typeof(IronRuby.Builtins.RubyProcess.Status), true, Context.ObjectClass, new System.Action(LoadProcess__Status_Instance), null, IronRuby.Builtins.RubyModule.EmptyArray, null); #endif DefineGlobalClass("Range", typeof(IronRuby.Builtins.Range), false, Context.ObjectClass, new System.Action(LoadRange_Instance), null, new IronRuby.Builtins.RubyModule[] {def21, }, new System.Delegate[] { - new System.Func>>, IronRuby.Builtins.RubyClass, System.Object, System.Object, System.Boolean, IronRuby.Builtins.Range>(IronRuby.Builtins.RangeOps.CreateRange), + new System.Func(IronRuby.Builtins.RangeOps.CreateRange), }); DefineGlobalClass("Regexp", typeof(IronRuby.Builtins.RubyRegex), false, Context.ObjectClass, new System.Action(LoadRegexp_Instance), new System.Action(LoadRegexp_Class), new IronRuby.Builtins.RubyModule[] {def21, }, new System.Delegate[] { new System.Func(IronRuby.Builtins.RegexpOps.Create), @@ -322,12 +321,12 @@ LoadSystem__Collections__IList_Instance(module); module.DefineLibraryMethod("initialize", 0x52, new System.Delegate[] { new System.Func(IronRuby.Builtins.ArrayOps.Reinitialize), - new System.Func(IronRuby.Builtins.ArrayOps.Reinitialize), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyArray, System.Object, System.Object>(IronRuby.Builtins.ArrayOps.Reinitialize), new System.Func(IronRuby.Builtins.ArrayOps.ReinitializeByRepeatedValue), }); module.DefineLibraryMethod("pack", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.ArrayOps.Pack), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyArray, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.Builtins.ArrayOps.Pack), }); module.DefineLibraryMethod("reverse!", 0x51, new System.Delegate[] { @@ -339,11 +338,11 @@ }); module.DefineLibraryMethod("sort", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyArray, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.Sort), + new System.Func(IronRuby.Builtins.ArrayOps.Sort), }); module.DefineLibraryMethod("sort!", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyArray, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.SortInPlace), + new System.Func(IronRuby.Builtins.ArrayOps.SortInPlace), }); module.DefineLibraryMethod("to_a", 0x51, new System.Delegate[] { @@ -368,12 +367,12 @@ module.DefineLibraryMethod("-", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Subtract), new System.Func(IronRuby.Builtins.BignumOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Subtract), + new System.Func(IronRuby.Builtins.BignumOps.Subtract), }); module.DefineLibraryMethod("%", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.ModuloOp), + new System.Func(IronRuby.Builtins.BignumOps.ModuloOp), }); module.DefineLibraryMethod("&", 0x51, new System.Delegate[] { @@ -385,20 +384,20 @@ module.DefineLibraryMethod("*", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Multiply), new System.Func(IronRuby.Builtins.BignumOps.Multiply), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Multiply), + new System.Func(IronRuby.Builtins.BignumOps.Multiply), }); module.DefineLibraryMethod("**", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Power), new System.Func(IronRuby.Builtins.BignumOps.Power), new System.Func(IronRuby.Builtins.BignumOps.Power), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Power), + new System.Func(IronRuby.Builtins.BignumOps.Power), }); module.DefineLibraryMethod("/", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Divide), new System.Func(IronRuby.Builtins.BignumOps.Divide), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Divide), + new System.Func(IronRuby.Builtins.BignumOps.Divide), }); module.DefineLibraryMethod("-@", 0x51, new System.Delegate[] { @@ -429,7 +428,7 @@ module.DefineLibraryMethod("+", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Add), new System.Func(IronRuby.Builtins.BignumOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Add), + new System.Func(IronRuby.Builtins.BignumOps.Add), }); module.DefineLibraryMethod("<<", 0x51, new System.Delegate[] { @@ -441,13 +440,13 @@ module.DefineLibraryMethod("<=>", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Compare), new System.Func(IronRuby.Builtins.BignumOps.Compare), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Compare), + new System.Func(IronRuby.Builtins.BignumOps.Compare), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Equal), new System.Func(IronRuby.Builtins.BignumOps.Equal), - new System.Func(IronRuby.Builtins.BignumOps.Equal), + new System.Func(IronRuby.Builtins.BignumOps.Equal), }); module.DefineLibraryMethod(">>", 0x51, new System.Delegate[] { @@ -468,12 +467,12 @@ module.DefineLibraryMethod("div", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Divide), new System.Func(IronRuby.Builtins.BignumOps.Divide), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Div), + new System.Func(IronRuby.Builtins.BignumOps.Div), }); module.DefineLibraryMethod("divmod", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.DivMod), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.DivMod), + new System.Func(IronRuby.Builtins.BignumOps.DivMod), }); module.DefineLibraryMethod("eql?", 0x51, new System.Delegate[] { @@ -488,18 +487,18 @@ module.DefineLibraryMethod("modulo", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Modulo), + new System.Func(IronRuby.Builtins.BignumOps.Modulo), }); module.DefineLibraryMethod("quo", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Quotient), new System.Func(IronRuby.Builtins.BignumOps.Quotient), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Quotient), + new System.Func(IronRuby.Builtins.BignumOps.Quotient), }); module.DefineLibraryMethod("remainder", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.BignumOps.Remainder), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, Microsoft.Scripting.Math.BigInteger, System.Object, System.Object>(IronRuby.Builtins.BignumOps.Remainder), + new System.Func(IronRuby.Builtins.BignumOps.Remainder), }); module.DefineLibraryMethod("size", 0x51, new System.Delegate[] { @@ -578,27 +577,27 @@ private void LoadComparable_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("<", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Comparable.Less), + new System.Func(IronRuby.Builtins.Comparable.Less), }); module.DefineLibraryMethod("<=", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Comparable.LessOrEqual), + new System.Func(IronRuby.Builtins.Comparable.LessOrEqual), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.Comparable.Equal), + new System.Func(IronRuby.Builtins.Comparable.Equal), }); module.DefineLibraryMethod(">", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Comparable.Greater), + new System.Func(IronRuby.Builtins.Comparable.Greater), }); module.DefineLibraryMethod(">=", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Comparable.GreaterOrEqual), + new System.Func(IronRuby.Builtins.Comparable.GreaterOrEqual), }); module.DefineLibraryMethod("between?", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Comparable.Between), + new System.Func(IronRuby.Builtins.Comparable.Between), }); } @@ -764,91 +763,91 @@ private void LoadEnumerable_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("all?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.TrueForAll), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.TrueForAll), }); module.DefineLibraryMethod("any?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.TrueForAny), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.TrueForAny), }); module.DefineLibraryMethod("collect", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Map), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Map), }); module.DefineLibraryMethod("detect", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Find), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Find), }); module.DefineLibraryMethod("each_with_index", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.EachWithIndex), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.EachWithIndex), }); module.DefineLibraryMethod("entries", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.ToArray), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.ToArray), }); module.DefineLibraryMethod("find", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Find), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Find), }); module.DefineLibraryMethod("find_all", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Select), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Select), }); module.DefineLibraryMethod("grep", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Grep), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Grep), }); module.DefineLibraryMethod("include?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Contains), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Enumerable.Contains), }); module.DefineLibraryMethod("inject", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Inject), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Inject), }); module.DefineLibraryMethod("map", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Map), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Map), }); module.DefineLibraryMethod("max", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.GetMaximum), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.GetMaximum), }); module.DefineLibraryMethod("member?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Contains), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.Enumerable.Contains), }); module.DefineLibraryMethod("min", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.GetMinimum), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.GetMinimum), }); module.DefineLibraryMethod("partition", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Partition), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Partition), }); module.DefineLibraryMethod("reject", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Reject), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Reject), }); module.DefineLibraryMethod("select", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Select), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Select), }); module.DefineLibraryMethod("sort", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Sort), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Enumerable.Sort), }); module.DefineLibraryMethod("sort_by", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.SortBy), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.SortBy), }); module.DefineLibraryMethod("to_a", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.ToArray), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.ToArray), }); module.DefineLibraryMethod("zip", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Enumerable.Zip), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Enumerable.Zip), }); } @@ -952,7 +951,7 @@ }); module.DefineLibraryMethod("replace", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.EnvironmentSingletonOps.Replace), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.Hash, System.Object>(IronRuby.Builtins.EnvironmentSingletonOps.Replace), }); module.DefineLibraryMethod("shift", 0x51, new System.Delegate[] { @@ -976,7 +975,7 @@ }); module.DefineLibraryMethod("update", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.EnvironmentSingletonOps.Update), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.Hash, System.Object>(IronRuby.Builtins.EnvironmentSingletonOps.Update), }); module.DefineLibraryMethod("value?", 0x51, new System.Delegate[] { @@ -1006,7 +1005,7 @@ }); module.DefineLibraryMethod("inspect", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.ExceptionOps.Inspect), + new System.Func, IronRuby.Runtime.RubyContext, System.Exception, IronRuby.Builtins.MutableString>(IronRuby.Builtins.ExceptionOps.Inspect), }); module.DefineLibraryMethod("message", 0x51, new System.Delegate[] { @@ -1019,11 +1018,11 @@ }); module.DefineLibraryMethod("to_s", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.ExceptionOps.GetMessage), + new System.Func, IronRuby.Runtime.RubyContext, System.Exception, IronRuby.Builtins.MutableString>(IronRuby.Builtins.ExceptionOps.GetMessage), }); module.DefineLibraryMethod("to_str", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.ExceptionOps.GetMessage), + new System.Func, IronRuby.Runtime.RubyContext, System.Exception, IronRuby.Builtins.MutableString>(IronRuby.Builtins.ExceptionOps.GetMessage), }); } @@ -1089,7 +1088,7 @@ private void LoadFile_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("atime", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.AccessTime), + new System.Func(IronRuby.Builtins.RubyFileOps.AccessTime), }); module.DefineLibraryMethod("basename", 0x61, new System.Delegate[] { @@ -1097,11 +1096,11 @@ }); module.DefineLibraryMethod("blockdev?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsBlockDevice), + new System.Func(IronRuby.Builtins.RubyFileOps.IsBlockDevice), }); module.DefineLibraryMethod("chardev?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsCharDevice), + new System.Func(IronRuby.Builtins.RubyFileOps.IsCharDevice), }); module.DefineLibraryMethod("chmod", 0x61, new System.Delegate[] { @@ -1109,7 +1108,7 @@ }); module.DefineLibraryMethod("ctime", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.CreateTime), + new System.Func(IronRuby.Builtins.RubyFileOps.CreateTime), }); module.DefineLibraryMethod("delete", 0x61, new System.Delegate[] { @@ -1126,11 +1125,11 @@ }); module.DefineLibraryMethod("executable?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsExecutable), + new System.Func(IronRuby.Builtins.RubyFileOps.IsExecutable), }); module.DefineLibraryMethod("executable_real?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsExecutable), + new System.Func(IronRuby.Builtins.RubyFileOps.IsExecutable), }); module.DefineLibraryMethod("exist?", 0x61, new System.Delegate[] { @@ -1164,23 +1163,23 @@ }); module.DefineLibraryMethod("ftype", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.FileType), + new System.Func(IronRuby.Builtins.RubyFileOps.FileType), }); module.DefineLibraryMethod("grpowned?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsGroupOwned), + new System.Func(IronRuby.Builtins.RubyFileOps.IsGroupOwned), }); module.DefineLibraryMethod("join", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.Join), + new System.Func, IronRuby.Builtins.RubyClass, System.Object[], IronRuby.Builtins.MutableString>(IronRuby.Builtins.RubyFileOps.Join), }); module.DefineLibraryMethod("lstat", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.Stat), + new System.Func(IronRuby.Builtins.RubyFileOps.Stat), }); module.DefineLibraryMethod("mtime", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.ModifiedTime), + new System.Func(IronRuby.Builtins.RubyFileOps.ModifiedTime), }); module.DefineLibraryMethod("open", 0x61, new System.Delegate[] { @@ -1195,19 +1194,19 @@ }); module.DefineLibraryMethod("owned?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsUserOwned), + new System.Func(IronRuby.Builtins.RubyFileOps.IsUserOwned), }); module.DefineLibraryMethod("pipe?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsPipe), + new System.Func(IronRuby.Builtins.RubyFileOps.IsPipe), }); module.DefineLibraryMethod("readable?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsReadable), + new System.Func(IronRuby.Builtins.RubyFileOps.IsReadable), }); module.DefineLibraryMethod("readable_real?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsReadable), + new System.Func(IronRuby.Builtins.RubyFileOps.IsReadable), }); module.DefineLibraryMethod("readlink", 0x61, new System.Delegate[] { @@ -1219,23 +1218,23 @@ }); module.DefineLibraryMethod("setgid?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsSetGid), + new System.Func(IronRuby.Builtins.RubyFileOps.IsSetGid), }); module.DefineLibraryMethod("setuid?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsSetUid), + new System.Func(IronRuby.Builtins.RubyFileOps.IsSetUid), }); module.DefineLibraryMethod("size", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.Size), + new System.Func(IronRuby.Builtins.RubyFileOps.Size), }); module.DefineLibraryMethod("size?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.NullableSize), + new System.Func(IronRuby.Builtins.RubyFileOps.NullableSize), }); module.DefineLibraryMethod("socket?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsSocket), + new System.Func(IronRuby.Builtins.RubyFileOps.IsSocket), }); module.DefineLibraryMethod("split", 0x61, new System.Delegate[] { @@ -1243,22 +1242,22 @@ }); module.DefineLibraryMethod("stat", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.Stat), + new System.Func(IronRuby.Builtins.RubyFileOps.Stat), }); module.DefineLibraryMethod("sticky?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsSticky), + new System.Func(IronRuby.Builtins.RubyFileOps.IsSticky), }); #if !SILVERLIGHT module.DefineLibraryMethod("symlink", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.SymLink), + new System.Func(IronRuby.Builtins.RubyFileOps.SymLink), }); #endif #if !SILVERLIGHT module.DefineLibraryMethod("symlink?", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyFileOps.IsSymLink), + new System.Func(IronRuby.Builtins.RubyFileOps.IsSymLink), }); #endif @@ -1496,12 +1495,12 @@ module.DefineLibraryMethod("-", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Subtract), new System.Func(IronRuby.Builtins.FixnumOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Subtract), + new System.Func(IronRuby.Builtins.FixnumOps.Subtract), }); module.DefineLibraryMethod("%", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.ModuloOp), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.ModuloOp), + new System.Func(IronRuby.Builtins.FixnumOps.ModuloOp), }); module.DefineLibraryMethod("&", 0x51, new System.Delegate[] { @@ -1514,18 +1513,18 @@ new System.Func(IronRuby.Builtins.FixnumOps.Multiply), new System.Func(IronRuby.Builtins.FixnumOps.Multiply), new System.Func(IronRuby.Builtins.FixnumOps.Multiply), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Multiply), + new System.Func(IronRuby.Builtins.FixnumOps.Multiply), }); module.DefineLibraryMethod("**", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Power), new System.Func(IronRuby.Builtins.FixnumOps.Power), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Power), + new System.Func(IronRuby.Builtins.FixnumOps.Power), }); module.DefineLibraryMethod("/", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.DivideOp), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.DivideOp), + new System.Func(IronRuby.Builtins.FixnumOps.DivideOp), }); module.DefineLibraryMethod("-@", 0x51, new System.Delegate[] { @@ -1556,12 +1555,12 @@ module.DefineLibraryMethod("+", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Add), new System.Func(IronRuby.Builtins.FixnumOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Add), + new System.Func(IronRuby.Builtins.FixnumOps.Add), }); module.DefineLibraryMethod("<", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.LessThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Boolean>(IronRuby.Builtins.FixnumOps.LessThan), + new System.Func(IronRuby.Builtins.FixnumOps.LessThan), }); module.DefineLibraryMethod("<<", 0x51, new System.Delegate[] { @@ -1571,27 +1570,27 @@ module.DefineLibraryMethod("<=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.LessThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Boolean>(IronRuby.Builtins.FixnumOps.LessThanOrEqual), + new System.Func(IronRuby.Builtins.FixnumOps.LessThanOrEqual), }); module.DefineLibraryMethod("<=>", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Compare), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Compare), + new System.Func(IronRuby.Builtins.FixnumOps.Compare), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Equal), - new System.Func(IronRuby.Builtins.FixnumOps.Equal), + new System.Func(IronRuby.Builtins.FixnumOps.Equal), }); module.DefineLibraryMethod(">", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.GreaterThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Boolean>(IronRuby.Builtins.FixnumOps.GreaterThan), + new System.Func(IronRuby.Builtins.FixnumOps.GreaterThan), }); module.DefineLibraryMethod(">=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.GreaterThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Boolean>(IronRuby.Builtins.FixnumOps.GreaterThanOrEqual), + new System.Func(IronRuby.Builtins.FixnumOps.GreaterThanOrEqual), }); module.DefineLibraryMethod(">>", 0x51, new System.Delegate[] { @@ -1605,12 +1604,12 @@ module.DefineLibraryMethod("div", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.DivideOp), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Div), + new System.Func(IronRuby.Builtins.FixnumOps.Div), }); module.DefineLibraryMethod("divmod", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.DivMod), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.DivMod), + new System.Func(IronRuby.Builtins.FixnumOps.DivMod), }); module.DefineLibraryMethod("id2name", 0x51, new System.Delegate[] { @@ -1619,12 +1618,12 @@ module.DefineLibraryMethod("modulo", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.ModuloOp), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Modulo), + new System.Func(IronRuby.Builtins.FixnumOps.Modulo), }); module.DefineLibraryMethod("quo", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.Quotient), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Int32, System.Object, System.Object>(IronRuby.Builtins.FixnumOps.Quotient), + new System.Func(IronRuby.Builtins.FixnumOps.Quotient), }); module.DefineLibraryMethod("size", 0x51, new System.Delegate[] { @@ -1654,7 +1653,6 @@ module.DefineLibraryMethod("induced_from", 0x61, new System.Delegate[] { new System.Func(IronRuby.Builtins.FixnumOps.InducedFrom), new System.Func(IronRuby.Builtins.FixnumOps.InducedFrom), - new System.Func(IronRuby.Builtins.FixnumOps.InducedFrom), }); } @@ -1676,82 +1674,82 @@ new System.Func(IronRuby.Builtins.FloatOps.Subtract), new System.Func(IronRuby.Builtins.FloatOps.Subtract), new System.Func(IronRuby.Builtins.FloatOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Subtract), + new System.Func(IronRuby.Builtins.FloatOps.Subtract), }); module.DefineLibraryMethod("%", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Modulo), new System.Func(IronRuby.Builtins.FloatOps.Modulo), new System.Func(IronRuby.Builtins.FloatOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.ModuloOp), + new System.Func(IronRuby.Builtins.FloatOps.ModuloOp), }); module.DefineLibraryMethod("*", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Multiply), new System.Func(IronRuby.Builtins.FloatOps.Multiply), new System.Func(IronRuby.Builtins.FloatOps.Multiply), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Multiply), + new System.Func(IronRuby.Builtins.FloatOps.Multiply), }); module.DefineLibraryMethod("**", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Power), new System.Func(IronRuby.Builtins.FloatOps.Power), new System.Func(IronRuby.Builtins.FloatOps.Power), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Power), + new System.Func(IronRuby.Builtins.FloatOps.Power), }); module.DefineLibraryMethod("/", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Divide), new System.Func(IronRuby.Builtins.FloatOps.Divide), new System.Func(IronRuby.Builtins.FloatOps.Divide), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Divide), + new System.Func(IronRuby.Builtins.FloatOps.Divide), }); module.DefineLibraryMethod("+", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Add), new System.Func(IronRuby.Builtins.FloatOps.Add), new System.Func(IronRuby.Builtins.FloatOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Add), + new System.Func(IronRuby.Builtins.FloatOps.Add), }); module.DefineLibraryMethod("<", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.LessThan), new System.Func(IronRuby.Builtins.FloatOps.LessThan), new System.Func(IronRuby.Builtins.FloatOps.LessThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Boolean>(IronRuby.Builtins.FloatOps.LessThan), + new System.Func(IronRuby.Builtins.FloatOps.LessThan), }); module.DefineLibraryMethod("<=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.LessThanOrEqual), new System.Func(IronRuby.Builtins.FloatOps.LessThanOrEqual), new System.Func(IronRuby.Builtins.FloatOps.LessThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Boolean>(IronRuby.Builtins.FloatOps.LessThanOrEqual), + new System.Func(IronRuby.Builtins.FloatOps.LessThanOrEqual), }); module.DefineLibraryMethod("<=>", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Compare), new System.Func(IronRuby.Builtins.FloatOps.Compare), new System.Func(IronRuby.Builtins.FloatOps.Compare), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Compare), + new System.Func(IronRuby.Builtins.FloatOps.Compare), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.Equal), - new System.Func(IronRuby.Builtins.FloatOps.Equal), + new System.Func(IronRuby.Builtins.FloatOps.Equal), }); module.DefineLibraryMethod(">", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.GreaterThan), new System.Func(IronRuby.Builtins.FloatOps.GreaterThan), new System.Func(IronRuby.Builtins.FloatOps.GreaterThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Boolean>(IronRuby.Builtins.FloatOps.GreaterThan), + new System.Func(IronRuby.Builtins.FloatOps.GreaterThan), }); module.DefineLibraryMethod(">=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.GreaterThanOrEqual), new System.Func(IronRuby.Builtins.FloatOps.GreaterThanOrEqual), new System.Func(IronRuby.Builtins.FloatOps.GreaterThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Boolean>(IronRuby.Builtins.FloatOps.GreaterThanOrEqual), + new System.Func(IronRuby.Builtins.FloatOps.GreaterThanOrEqual), }); module.DefineLibraryMethod("abs", 0x51, new System.Delegate[] { @@ -1770,7 +1768,7 @@ new System.Func(IronRuby.Builtins.FloatOps.DivMod), new System.Func(IronRuby.Builtins.FloatOps.DivMod), new System.Func(IronRuby.Builtins.FloatOps.DivMod), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.DivMod), + new System.Func(IronRuby.Builtins.FloatOps.DivMod), }); module.DefineLibraryMethod("finite?", 0x51, new System.Delegate[] { @@ -1793,7 +1791,7 @@ new System.Func(IronRuby.Builtins.FloatOps.Modulo), new System.Func(IronRuby.Builtins.FloatOps.Modulo), new System.Func(IronRuby.Builtins.FloatOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Double, System.Object, System.Object>(IronRuby.Builtins.FloatOps.Modulo), + new System.Func(IronRuby.Builtins.FloatOps.Modulo), }); module.DefineLibraryMethod("nan?", 0x51, new System.Delegate[] { @@ -1833,8 +1831,8 @@ private void LoadFloat_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("induced_from", 0x61, new System.Delegate[] { new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), - new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), - new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), + new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), + new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), new System.Func(IronRuby.Builtins.FloatOps.InducedFrom), }); @@ -1867,12 +1865,12 @@ LoadSystem__Collections__Generic__IDictionary_Instance(module); module.DefineLibraryMethod("[]", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object, System.Object>(IronRuby.Builtins.HashOps.GetElement), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object, System.Object>(IronRuby.Builtins.HashOps.GetElement), }); module.DefineLibraryMethod("default", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.HashOps.GetDefaultValue), - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object, System.Object>(IronRuby.Builtins.HashOps.GetDefaultValue), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object, System.Object>(IronRuby.Builtins.HashOps.GetDefaultValue), }); module.DefineLibraryMethod("default_proc", 0x51, new System.Delegate[] { @@ -1898,11 +1896,11 @@ }); module.DefineLibraryMethod("replace", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.HashOps.Replace), + new System.Func, IronRuby.Builtins.Hash>(IronRuby.Builtins.HashOps.Replace), }); module.DefineLibraryMethod("shift", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object>(IronRuby.Builtins.HashOps.Shift), + new System.Func>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Hash, System.Object>(IronRuby.Builtins.HashOps.Shift), }); } @@ -1923,12 +1921,12 @@ }); module.DefineLibraryMethod("chr", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Integer.ToChr), + new System.Func(IronRuby.Builtins.Integer.ToChr), }); module.DefineLibraryMethod("downto", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.DownTo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Integer.DownTo), + new System.Func(IronRuby.Builtins.Integer.DownTo), }); module.DefineLibraryMethod("floor", 0x51, new System.Delegate[] { @@ -1941,7 +1939,7 @@ module.DefineLibraryMethod("next", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.Next), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Integer.Next), + new System.Func(IronRuby.Builtins.Integer.Next), }); module.DefineLibraryMethod("round", 0x51, new System.Delegate[] { @@ -1950,12 +1948,12 @@ module.DefineLibraryMethod("succ", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.Next), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Integer.Next), + new System.Func(IronRuby.Builtins.Integer.Next), }); module.DefineLibraryMethod("times", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.Times), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.Builtins.Integer.Times), + new System.Func(IronRuby.Builtins.Integer.Times), }); module.DefineLibraryMethod("to_i", 0x51, new System.Delegate[] { @@ -1972,7 +1970,7 @@ module.DefineLibraryMethod("upto", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.UpTo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object>(IronRuby.Builtins.Integer.UpTo), + new System.Func(IronRuby.Builtins.Integer.UpTo), }); } @@ -1981,7 +1979,7 @@ module.DefineLibraryMethod("induced_from", 0x61, new System.Delegate[] { new System.Func(IronRuby.Builtins.Integer.InducedFrom), new System.Func(IronRuby.Builtins.Integer.InducedFrom), - new System.Func(IronRuby.Builtins.Integer.InducedFrom), + new System.Func(IronRuby.Builtins.Integer.InducedFrom), new System.Func(IronRuby.Builtins.Integer.InducedFrom), }); @@ -2099,11 +2097,11 @@ module.DefineLibraryMethod("print", 0x51, new System.Delegate[] { new System.Action(IronRuby.Builtins.RubyIOOps.Print), new System.Action(IronRuby.Builtins.RubyIOOps.Print), - new System.Action(IronRuby.Builtins.RubyIOOps.Print), + new System.Action(IronRuby.Builtins.RubyIOOps.Print), }); module.DefineLibraryMethod("printf", 0x51, new System.Delegate[] { - new System.Action>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyIO, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.RubyIOOps.PrintFormatted), + new System.Action, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyIO, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.RubyIOOps.PrintFormatted), }); module.DefineLibraryMethod("putc", 0x51, new System.Delegate[] { @@ -2114,8 +2112,8 @@ module.DefineLibraryMethod("puts", 0x51, new System.Delegate[] { new System.Action(IronRuby.Builtins.RubyIOOps.PutsEmptyLine), new System.Action(IronRuby.Builtins.RubyIOOps.Puts), - new System.Action(IronRuby.Builtins.RubyIOOps.Puts), - new System.Action(IronRuby.Builtins.RubyIOOps.Puts), + new System.Action(IronRuby.Builtins.RubyIOOps.Puts), + new System.Action(IronRuby.Builtins.RubyIOOps.Puts), }); module.DefineLibraryMethod("read", 0x51, new System.Delegate[] { @@ -2176,7 +2174,7 @@ module.DefineLibraryMethod("write", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.RubyIOOps.Write), - new System.Func(IronRuby.Builtins.RubyIOOps.Write), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyIO, System.Object, System.Int32>(IronRuby.Builtins.RubyIOOps.Write), }); } @@ -2258,7 +2256,7 @@ }); module.DefineLibraryMethod("===", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.HashEquals), + new System.Func(IronRuby.Builtins.KernelOps.HashEquals), }); module.DefineLibraryMethod("Array", 0x52, new System.Delegate[] { @@ -2298,7 +2296,7 @@ }); module.DefineLibraryMethod("clone", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Clone), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.Clone), }); module.DefineLibraryMethod("display", 0x51, new System.Delegate[] { @@ -2306,7 +2304,7 @@ }); module.DefineLibraryMethod("dup", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Duplicate), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.Duplicate), }); module.DefineLibraryMethod("eql?", 0x51, new System.Delegate[] { @@ -2342,13 +2340,13 @@ }); module.DefineLibraryMethod("extend", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyModule[], System.Object>(IronRuby.Builtins.KernelOps.Extend), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyModule[], System.Object>(IronRuby.Builtins.KernelOps.Extend), }); module.DefineLibraryMethod("fail", 0x52, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.RaiseException), new System.Action(IronRuby.Builtins.KernelOps.RaiseException), - new System.Action>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.KernelOps.RaiseException), + new System.Action(IronRuby.Builtins.KernelOps.RaiseException), }); module.DefineLibraryMethod("Float", 0x52, new System.Delegate[] { @@ -2356,7 +2354,7 @@ }); module.DefineLibraryMethod("format", 0x52, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Sprintf), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[], IronRuby.Builtins.MutableString>(IronRuby.Builtins.KernelOps.Sprintf), }); module.DefineLibraryMethod("freeze", 0x51, new System.Delegate[] { @@ -2369,12 +2367,12 @@ }); module.DefineLibraryMethod("getc", 0x52, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputCharacter), + new System.Func(IronRuby.Builtins.KernelOps.ReadInputCharacter), }); module.DefineLibraryMethod("gets", 0x52, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), }); module.DefineLibraryMethod("global_variables", 0x52, new System.Delegate[] { @@ -2394,7 +2392,7 @@ }); module.DefineLibraryMethod("inspect", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Inspect), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.Builtins.KernelOps.Inspect), }); module.DefineLibraryMethod("instance_eval", 0x51, new System.Delegate[] { @@ -2492,18 +2490,18 @@ }); module.DefineLibraryMethod("p", 0x52, new System.Delegate[] { - new System.Action(IronRuby.Builtins.KernelOps.PrintInspect), + new System.Action(IronRuby.Builtins.KernelOps.PrintInspect), }); module.DefineLibraryMethod("print", 0x52, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.Print), new System.Action(IronRuby.Builtins.KernelOps.Print), - new System.Action(IronRuby.Builtins.KernelOps.Print), + new System.Action(IronRuby.Builtins.KernelOps.Print), }); module.DefineLibraryMethod("printf", 0x52, new System.Delegate[] { - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), + new System.Action, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), + new System.Action, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), }); module.DefineLibraryMethod("private_methods", 0x51, new System.Delegate[] { @@ -2529,15 +2527,15 @@ module.DefineLibraryMethod("puts", 0x52, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.PutsEmptyLine), - new System.Action(IronRuby.Builtins.KernelOps.PutString), + new System.Action(IronRuby.Builtins.KernelOps.PutString), new System.Action(IronRuby.Builtins.KernelOps.PutString), - new System.Action(IronRuby.Builtins.KernelOps.PutString), + new System.Action(IronRuby.Builtins.KernelOps.PutString), }); module.DefineLibraryMethod("raise", 0x52, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.RaiseException), new System.Action(IronRuby.Builtins.KernelOps.RaiseException), - new System.Action>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.KernelOps.RaiseException), + new System.Action(IronRuby.Builtins.KernelOps.RaiseException), }); module.DefineLibraryMethod("rand", 0x52, new System.Delegate[] { @@ -2545,7 +2543,7 @@ new System.Func(IronRuby.Builtins.KernelOps.Rand), new System.Func(IronRuby.Builtins.KernelOps.Rand), new System.Func(IronRuby.Builtins.KernelOps.Rand), - new System.Func(IronRuby.Builtins.KernelOps.Rand), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.KernelOps.Rand), }); module.DefineLibraryMethod("remove_instance_variable", 0x52, new System.Delegate[] { @@ -2607,11 +2605,11 @@ }); module.DefineLibraryMethod("sprintf", 0x52, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Sprintf), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[], IronRuby.Builtins.MutableString>(IronRuby.Builtins.KernelOps.Sprintf), }); module.DefineLibraryMethod("String", 0x52, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.ToString), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ToString), }); #if !SILVERLIGHT @@ -2657,7 +2655,7 @@ }); module.DefineLibraryMethod("warn", 0x52, new System.Delegate[] { - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReportWarning), + new System.Action(IronRuby.Builtins.KernelOps.ReportWarning), }); } @@ -2720,7 +2718,7 @@ module.DefineLibraryMethod("fail", 0x61, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.RaiseException), new System.Action(IronRuby.Builtins.KernelOps.RaiseException), - new System.Action>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.KernelOps.RaiseException), + new System.Action(IronRuby.Builtins.KernelOps.RaiseException), }); module.DefineLibraryMethod("Float", 0x61, new System.Delegate[] { @@ -2728,16 +2726,16 @@ }); module.DefineLibraryMethod("format", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Sprintf), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[], IronRuby.Builtins.MutableString>(IronRuby.Builtins.KernelOps.Sprintf), }); module.DefineLibraryMethod("getc", 0x61, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputCharacter), + new System.Func(IronRuby.Builtins.KernelOps.ReadInputCharacter), }); module.DefineLibraryMethod("gets", 0x61, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.KernelOps.ReadInputLine), }); module.DefineLibraryMethod("global_variables", 0x61, new System.Delegate[] { @@ -2786,18 +2784,18 @@ }); module.DefineLibraryMethod("p", 0x61, new System.Delegate[] { - new System.Action(IronRuby.Builtins.KernelOps.PrintInspect), + new System.Action(IronRuby.Builtins.KernelOps.PrintInspect), }); module.DefineLibraryMethod("print", 0x61, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.Print), new System.Action(IronRuby.Builtins.KernelOps.Print), - new System.Action(IronRuby.Builtins.KernelOps.Print), + new System.Action(IronRuby.Builtins.KernelOps.Print), }); module.DefineLibraryMethod("printf", 0x61, new System.Delegate[] { - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), + new System.Action, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), + new System.Action, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PrintFormatted), }); module.DefineLibraryMethod("proc", 0x61, new System.Delegate[] { @@ -2811,15 +2809,15 @@ module.DefineLibraryMethod("puts", 0x61, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.PutsEmptyLine), - new System.Action(IronRuby.Builtins.KernelOps.PutString), + new System.Action(IronRuby.Builtins.KernelOps.PutString), new System.Action(IronRuby.Builtins.KernelOps.PutString), - new System.Action(IronRuby.Builtins.KernelOps.PutString), + new System.Action(IronRuby.Builtins.KernelOps.PutString), }); module.DefineLibraryMethod("raise", 0x61, new System.Delegate[] { new System.Action(IronRuby.Builtins.KernelOps.RaiseException), new System.Action(IronRuby.Builtins.KernelOps.RaiseException), - new System.Action>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.KernelOps.RaiseException), + new System.Action(IronRuby.Builtins.KernelOps.RaiseException), }); module.DefineLibraryMethod("rand", 0x61, new System.Delegate[] { @@ -2827,7 +2825,7 @@ new System.Func(IronRuby.Builtins.KernelOps.Rand), new System.Func(IronRuby.Builtins.KernelOps.Rand), new System.Func(IronRuby.Builtins.KernelOps.Rand), - new System.Func(IronRuby.Builtins.KernelOps.Rand), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.KernelOps.Rand), }); module.DefineLibraryMethod("require", 0x61, new System.Delegate[] { @@ -2851,11 +2849,11 @@ }); module.DefineLibraryMethod("sprintf", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.Sprintf), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, System.Object[], IronRuby.Builtins.MutableString>(IronRuby.Builtins.KernelOps.Sprintf), }); module.DefineLibraryMethod("String", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.KernelOps.ToString), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ToString), }); #if !SILVERLIGHT @@ -2877,7 +2875,7 @@ #endif module.DefineLibraryMethod("warn", 0x61, new System.Delegate[] { - new System.Action>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.KernelOps.ReportWarning), + new System.Action(IronRuby.Builtins.KernelOps.ReportWarning), }); } @@ -2893,19 +2891,19 @@ new System.Func, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.MutableString>(IronRuby.Builtins.RubyMarshal.Dump), new System.Func, IronRuby.Builtins.RubyModule, System.Object, System.Int32, IronRuby.Builtins.MutableString>(IronRuby.Builtins.RubyMarshal.Dump), new System.Func, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.RubyIO, System.Nullable, System.Object>(IronRuby.Builtins.RubyMarshal.Dump), - new System.Func, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Builtins.RubyModule, System.Object, System.Object, System.Nullable, System.Object>(IronRuby.Builtins.RubyMarshal.Dump), + new System.Func, IronRuby.Runtime.RespondToStorage, IronRuby.Builtins.RubyModule, System.Object, System.Object, System.Nullable, System.Object>(IronRuby.Builtins.RubyMarshal.Dump), }); module.DefineLibraryMethod("load", 0x61, new System.Delegate[] { new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, IronRuby.Builtins.MutableString, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyIO, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), - new System.Func, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), + new System.Func, IronRuby.Runtime.RespondToStorage, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), }); module.DefineLibraryMethod("restore", 0x61, new System.Delegate[] { new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, IronRuby.Builtins.MutableString, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyIO, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), - new System.Func, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), + new System.Func, IronRuby.Runtime.RespondToStorage, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyModule, System.Object, IronRuby.Builtins.Proc, System.Object>(IronRuby.Builtins.RubyMarshal.Load), }); } @@ -2915,7 +2913,7 @@ module.DefineLibraryMethod("[]", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MatchDataOps.GetGroup), new System.Func(IronRuby.Builtins.MatchDataOps.GetGroup), - new System.Func(IronRuby.Builtins.MatchDataOps.GetGroup), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MatchData, IronRuby.Builtins.Range, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.MatchDataOps.GetGroup), }); module.DefineLibraryMethod("begin", 0x51, new System.Delegate[] { @@ -2975,7 +2973,7 @@ }); module.DefineLibraryMethod("values_at", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MatchDataOps.ValuesAt), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MatchData, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.MatchDataOps.ValuesAt), }); } @@ -3380,7 +3378,7 @@ }); module.DefineLibraryMethod("include", 0x52, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyModule[], IronRuby.Builtins.RubyModule>(IronRuby.Builtins.ModuleOps.Include), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyModule[], IronRuby.Builtins.RubyModule>(IronRuby.Builtins.ModuleOps.Include), }); module.DefineLibraryMethod("include?", 0x51, new System.Delegate[] { @@ -3579,7 +3577,7 @@ private void LoadNumeric_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("-@", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Numeric.UnaryMinus), + new System.Func(IronRuby.Builtins.Numeric.UnaryMinus), }); module.DefineLibraryMethod("+@", 0x51, new System.Delegate[] { @@ -3591,7 +3589,7 @@ }); module.DefineLibraryMethod("abs", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Numeric.Abs), + new System.Func(IronRuby.Builtins.Numeric.Abs), }); module.DefineLibraryMethod("ceil", 0x51, new System.Delegate[] { @@ -3603,15 +3601,15 @@ }); module.DefineLibraryMethod("div", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.Numeric.Div), + new System.Func(IronRuby.Builtins.Numeric.Div), }); module.DefineLibraryMethod("divmod", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.Numeric.DivMod), + new System.Func(IronRuby.Builtins.Numeric.DivMod), }); module.DefineLibraryMethod("eql?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Numeric.Eql), + new System.Func(IronRuby.Builtins.Numeric.Eql), }); module.DefineLibraryMethod("floor", 0x51, new System.Delegate[] { @@ -3623,19 +3621,19 @@ }); module.DefineLibraryMethod("modulo", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.Numeric.Modulo), + new System.Func(IronRuby.Builtins.Numeric.Modulo), }); module.DefineLibraryMethod("nonzero?", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Numeric.IsNonZero), + new System.Func(IronRuby.Builtins.Numeric.IsNonZero), }); module.DefineLibraryMethod("quo", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.Numeric.Quo), + new System.Func(IronRuby.Builtins.Numeric.Quo), }); module.DefineLibraryMethod("remainder", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, System.Object, System.Object>(IronRuby.Builtins.Numeric.Remainder), + new System.Func(IronRuby.Builtins.Numeric.Remainder), }); module.DefineLibraryMethod("round", 0x51, new System.Delegate[] { @@ -3646,11 +3644,11 @@ new System.Func(IronRuby.Builtins.Numeric.Step), new System.Func(IronRuby.Builtins.Numeric.Step), new System.Func(IronRuby.Builtins.Numeric.Step), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object, System.Object, System.Object>(IronRuby.Builtins.Numeric.Step), + new System.Func(IronRuby.Builtins.Numeric.Step), }); module.DefineLibraryMethod("to_int", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Numeric.ToInt), + new System.Func(IronRuby.Builtins.Numeric.ToInt), }); module.DefineLibraryMethod("truncate", 0x51, new System.Delegate[] { @@ -3658,7 +3656,7 @@ }); module.DefineLibraryMethod("zero?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.Numeric.IsZero), + new System.Func(IronRuby.Builtins.Numeric.IsZero), }); } @@ -3699,15 +3697,15 @@ private void LoadPrecision_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("prec", 0x51, new System.Delegate[] { - new System.Func>>, System.Object, IronRuby.Builtins.RubyClass, System.Object>(IronRuby.Builtins.Precision.Prec), + new System.Func>, System.Object, IronRuby.Builtins.RubyClass, System.Object>(IronRuby.Builtins.Precision.Prec), }); module.DefineLibraryMethod("prec_f", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Precision.PrecFloat), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Precision.PrecFloat), }); module.DefineLibraryMethod("prec_i", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Precision.PrecInteger), + new System.Func>, IronRuby.Runtime.RubyContext, System.Object, System.Object>(IronRuby.Builtins.Precision.PrecInteger), }); } @@ -3768,8 +3766,8 @@ private void LoadProc_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("new", 0x61, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyClass, IronRuby.Builtins.Proc>(IronRuby.Builtins.ProcOps.CreateNew), - new System.Func>>, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyClass, IronRuby.Builtins.Proc>(IronRuby.Builtins.ProcOps.CreateNew), + new System.Func>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyClass, IronRuby.Builtins.Proc>(IronRuby.Builtins.ProcOps.CreateNew), + new System.Func>, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyClass, IronRuby.Builtins.Proc>(IronRuby.Builtins.ProcOps.CreateNew), }); } @@ -3855,11 +3853,11 @@ module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.RangeOps.Equals), - new System.Func(IronRuby.Builtins.RangeOps.Equals), + new System.Func(IronRuby.Builtins.RangeOps.Equals), }); module.DefineLibraryMethod("===", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Range, System.Object, System.Boolean>(IronRuby.Builtins.RangeOps.CaseEquals), + new System.Func(IronRuby.Builtins.RangeOps.CaseEquals), }); module.DefineLibraryMethod("begin", 0x51, new System.Delegate[] { @@ -3867,7 +3865,7 @@ }); module.DefineLibraryMethod("each", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.Range, System.Object>(IronRuby.Builtins.RangeOps.Each), + new System.Func, IronRuby.Runtime.RespondToStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.UnaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.Range, System.Object>(IronRuby.Builtins.RangeOps.Each), }); module.DefineLibraryMethod("end", 0x51, new System.Delegate[] { @@ -3876,7 +3874,7 @@ module.DefineLibraryMethod("eql?", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.RangeOps.Equals), - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Range, IronRuby.Builtins.Range, System.Boolean>(IronRuby.Builtins.RangeOps.Eql), + new System.Func(IronRuby.Builtins.RangeOps.Eql), }); module.DefineLibraryMethod("exclude_end?", 0x51, new System.Delegate[] { @@ -3892,11 +3890,11 @@ }); module.DefineLibraryMethod("include?", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Range, System.Object, System.Boolean>(IronRuby.Builtins.RangeOps.CaseEquals), + new System.Func(IronRuby.Builtins.RangeOps.CaseEquals), }); module.DefineLibraryMethod("initialize", 0x52, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Range, System.Object, System.Object, System.Boolean, IronRuby.Builtins.Range>(IronRuby.Builtins.RangeOps.Reinitialize), + new System.Func(IronRuby.Builtins.RangeOps.Reinitialize), }); module.DefineLibraryMethod("inspect", 0x51, new System.Delegate[] { @@ -3908,15 +3906,15 @@ }); module.DefineLibraryMethod("member?", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.Range, System.Object, System.Boolean>(IronRuby.Builtins.RangeOps.CaseEquals), + new System.Func(IronRuby.Builtins.RangeOps.CaseEquals), }); module.DefineLibraryMethod("step", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.Range, System.Object, System.Object>(IronRuby.Builtins.RangeOps.Step), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RespondToStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.UnaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.Range, System.Object, System.Object>(IronRuby.Builtins.RangeOps.Step), }); module.DefineLibraryMethod("to_s", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RangeOps.ToS), + new System.Func(IronRuby.Builtins.RangeOps.ToS), }); } @@ -3932,7 +3930,7 @@ module.SetConstant("MULTILINE", IronRuby.Builtins.RegexpOps.MULTILINE); module.DefineLibraryMethod("~", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RegexpOps.ImplicitMatch), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.RegexpOps.ImplicitMatch), }); module.DefineLibraryMethod("=~", 0x51, new System.Delegate[] { @@ -4013,7 +4011,7 @@ }); module.DefineLibraryMethod("union", 0x61, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RegexpOps.Union), + new System.Func, IronRuby.Builtins.RubyClass, System.Object[], IronRuby.Builtins.RubyRegex>(IronRuby.Builtins.RegexpOps.Union), }); } @@ -4037,7 +4035,7 @@ module.HideMethod("clone"); module.HideMethod("version"); module.DefineLibraryMethod("%", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MutableStringOps.Format), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, System.Object, IronRuby.Builtins.MutableString>(IronRuby.Builtins.MutableStringOps.Format), }); module.DefineLibraryMethod("*", 0x51, new System.Delegate[] { @@ -4047,7 +4045,7 @@ module.DefineLibraryMethod("[]", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.GetChar), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), - new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.Range, IronRuby.Builtins.MutableString>(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), @@ -4057,7 +4055,7 @@ new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceCharacter), new System.Func(IronRuby.Builtins.MutableStringOps.SetCharacter), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceSubstring), - new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceSubstring), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.Range, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.Builtins.MutableStringOps.ReplaceSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceSubstring), }); @@ -4073,23 +4071,23 @@ module.DefineLibraryMethod("<=>", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.Compare), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, System.Object, System.Object>(IronRuby.Builtins.MutableStringOps.Compare), + new System.Func(IronRuby.Builtins.MutableStringOps.Compare), }); module.DefineLibraryMethod("=~", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.Match), new System.Func(IronRuby.Builtins.MutableStringOps.Match), - new System.Func>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, System.Object, System.Object>(IronRuby.Builtins.MutableStringOps.Match), + new System.Func>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, System.Object, System.Object>(IronRuby.Builtins.MutableStringOps.Match), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.StringEquals), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, System.Object, System.Boolean>(IronRuby.Builtins.MutableStringOps.Equals), + new System.Func(IronRuby.Builtins.MutableStringOps.Equals), }); module.DefineLibraryMethod("===", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.StringEquals), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, System.Object, System.Boolean>(IronRuby.Builtins.MutableStringOps.Equals), + new System.Func(IronRuby.Builtins.MutableStringOps.Equals), }); module.DefineLibraryMethod("capitalize", 0x51, new System.Delegate[] { @@ -4179,12 +4177,12 @@ module.DefineLibraryMethod("gsub", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceAll), - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceAll), - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceAll), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceAll), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceAll), }); module.DefineLibraryMethod("gsub!", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceAllInPlace), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceAllInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceAllInPlace), }); @@ -4242,8 +4240,8 @@ }); module.DefineLibraryMethod("match", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.MatchRegexp), - new System.Func>>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.MatchObject), + new System.Func>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.MatchRegexp), + new System.Func>, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.MatchObject), }); module.DefineLibraryMethod("next", 0x51, new System.Delegate[] { @@ -4303,7 +4301,7 @@ module.DefineLibraryMethod("slice", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.GetChar), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), - new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.Range, IronRuby.Builtins.MutableString>(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), new System.Func(IronRuby.Builtins.MutableStringOps.GetSubstring), @@ -4312,16 +4310,16 @@ module.DefineLibraryMethod("slice!", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.MutableStringOps.RemoveCharInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), - new System.Func(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.Range, IronRuby.Builtins.MutableString>(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.RemoveSubstringInPlace), }); module.DefineLibraryMethod("split", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MutableStringOps.Split), - new System.Func(IronRuby.Builtins.MutableStringOps.Split), - new System.Func(IronRuby.Builtins.MutableStringOps.Split), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.MutableStringOps.Split), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Int32, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.MutableStringOps.Split), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Int32, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.MutableStringOps.Split), }); module.DefineLibraryMethod("squeeze", 0x51, new System.Delegate[] { @@ -4341,13 +4339,13 @@ }); module.DefineLibraryMethod("sub", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceFirst), - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceFirst), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceFirst), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceFirst), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceFirst), }); module.DefineLibraryMethod("sub!", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.MutableStringOps.BlockReplaceFirstInPlace), + new System.Func, IronRuby.Runtime.RubyScope, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.RubyRegex, System.Object>(IronRuby.Builtins.MutableStringOps.BlockReplaceFirstInPlace), new System.Func(IronRuby.Builtins.MutableStringOps.ReplaceFirstInPlace), }); @@ -4425,7 +4423,7 @@ }); module.DefineLibraryMethod("upto", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.UpTo), + new System.Func, IronRuby.Runtime.RespondToStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.UnaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Object>(IronRuby.Builtins.MutableStringOps.UpTo), }); } @@ -4439,18 +4437,18 @@ new System.Func(IronRuby.Builtins.RubyStructOps.GetValue), new System.Func(IronRuby.Builtins.RubyStructOps.GetValue), new System.Func(IronRuby.Builtins.RubyStructOps.GetValue), - new System.Func(IronRuby.Builtins.RubyStructOps.GetValue), + new System.Func, IronRuby.Builtins.RubyStruct, System.Object, System.Object>(IronRuby.Builtins.RubyStructOps.GetValue), }); module.DefineLibraryMethod("[]=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.RubyStructOps.SetValue), new System.Func(IronRuby.Builtins.RubyStructOps.SetValue), new System.Func(IronRuby.Builtins.RubyStructOps.SetValue), - new System.Func(IronRuby.Builtins.RubyStructOps.SetValue), + new System.Func, IronRuby.Builtins.RubyStruct, System.Object, System.Object, System.Object>(IronRuby.Builtins.RubyStructOps.SetValue), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyStructOps.Equals), + new System.Func(IronRuby.Builtins.RubyStructOps.Equals), }); module.DefineLibraryMethod("each", 0x51, new System.Delegate[] { @@ -4490,7 +4488,7 @@ }); module.DefineLibraryMethod("select", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyStructOps.Select), + new System.Func>, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyStruct, IronRuby.Builtins.RubyArray>(IronRuby.Builtins.RubyStructOps.Select), }); module.DefineLibraryMethod("size", 0x51, new System.Delegate[] { @@ -4510,7 +4508,7 @@ }); module.DefineLibraryMethod("values_at", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.RubyStructOps.ValuesAt), + new System.Func, IronRuby.Builtins.RubyStruct, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.RubyStructOps.ValuesAt), }); } @@ -4575,7 +4573,7 @@ }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.Equals), + new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.Equals), }); module.DefineLibraryMethod("clear", 0x51, new System.Delegate[] { @@ -4627,7 +4625,7 @@ }); module.DefineLibraryMethod("has_value?", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.HasValue), + new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.HasValue), }); module.DefineLibraryMethod("include?", 0x51, new System.Delegate[] { @@ -4635,7 +4633,7 @@ }); module.DefineLibraryMethod("index", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Object>(IronRuby.Builtins.IDictionaryOps.Index), + new System.Func, System.Object, System.Object>(IronRuby.Builtins.IDictionaryOps.Index), }); module.DefineLibraryMethod("indexes", 0x51, new System.Delegate[] { @@ -4671,11 +4669,11 @@ }); module.DefineLibraryMethod("merge", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Object>(IronRuby.Builtins.IDictionaryOps.Merge), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.Generic.IDictionary, System.Collections.Generic.IDictionary, System.Object>(IronRuby.Builtins.IDictionaryOps.Merge), }); module.DefineLibraryMethod("merge!", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Object>(IronRuby.Builtins.IDictionaryOps.Update), + new System.Func, System.Collections.Generic.IDictionary, System.Object>(IronRuby.Builtins.IDictionaryOps.Update), }); module.DefineLibraryMethod("rehash", 0x51, new System.Delegate[] { @@ -4683,7 +4681,7 @@ }); module.DefineLibraryMethod("reject", 0x51, new System.Delegate[] { - new System.Func, System.Object>(IronRuby.Builtins.IDictionaryOps.Reject), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.Generic.IDictionary, System.Object>(IronRuby.Builtins.IDictionaryOps.Reject), }); module.DefineLibraryMethod("reject!", 0x51, new System.Delegate[] { @@ -4691,7 +4689,7 @@ }); module.DefineLibraryMethod("replace", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Collections.Generic.IDictionary>(IronRuby.Builtins.IDictionaryOps.Replace), + new System.Func, IronRuby.Builtins.Hash>(IronRuby.Builtins.IDictionaryOps.Replace), }); module.DefineLibraryMethod("select", 0x51, new System.Delegate[] { @@ -4707,7 +4705,7 @@ }); module.DefineLibraryMethod("sort", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.Generic.IDictionary, System.Object>(IronRuby.Builtins.IDictionaryOps.Sort), + new System.Func, System.Object>(IronRuby.Builtins.IDictionaryOps.Sort), }); module.DefineLibraryMethod("store", 0x51, new System.Delegate[] { @@ -4723,15 +4721,15 @@ }); module.DefineLibraryMethod("to_s", 0x51, new System.Delegate[] { - new System.Func, IronRuby.Builtins.MutableString>(IronRuby.Builtins.IDictionaryOps.ToString), + new System.Func, IronRuby.Builtins.MutableString>(IronRuby.Builtins.IDictionaryOps.ToString), }); module.DefineLibraryMethod("update", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Object>(IronRuby.Builtins.IDictionaryOps.Update), + new System.Func, System.Collections.Generic.IDictionary, System.Object>(IronRuby.Builtins.IDictionaryOps.Update), }); module.DefineLibraryMethod("value?", 0x51, new System.Delegate[] { - new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.HasValue), + new System.Func, System.Object, System.Boolean>(IronRuby.Builtins.IDictionaryOps.HasValue), }); module.DefineLibraryMethod("values", 0x51, new System.Delegate[] { @@ -4755,7 +4753,7 @@ private void LoadSystem__Collections__IList_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("-", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Difference), + new System.Func(IronRuby.Builtins.IListOps.Difference), }); module.DefineLibraryMethod("&", 0x51, new System.Delegate[] { @@ -4764,20 +4762,20 @@ module.DefineLibraryMethod("*", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.Repetition), - new System.Func(IronRuby.Builtins.IListOps.Repetition), - new System.Func(IronRuby.Builtins.IListOps.Repetition), + new System.Func(IronRuby.Builtins.IListOps.Repetition), + new System.Func, IronRuby.Runtime.UnaryOpStorage, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object, System.Object>(IronRuby.Builtins.IListOps.Repetition), }); module.DefineLibraryMethod("[]", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.GetElement), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElements), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElement), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElements), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElement), }); module.DefineLibraryMethod("[]=", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.SetElement), new System.Func(IronRuby.Builtins.IListOps.SetElement), - new System.Func(IronRuby.Builtins.IListOps.SetElement), + new System.Func, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Object, System.Object>(IronRuby.Builtins.IListOps.SetElement), }); module.DefineLibraryMethod("|", 0x51, new System.Delegate[] { @@ -4793,16 +4791,16 @@ }); module.DefineLibraryMethod("<=>", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList, System.Object>(IronRuby.Builtins.IListOps.Compare), + new System.Func(IronRuby.Builtins.IListOps.Compare), }); module.DefineLibraryMethod("==", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.Equals), - new System.Func(IronRuby.Builtins.IListOps.Equals), + new System.Func(IronRuby.Builtins.IListOps.Equals), }); module.DefineLibraryMethod("assoc", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.GetContainerOfFirstItem), + new System.Func(IronRuby.Builtins.IListOps.GetContainerOfFirstItem), }); module.DefineLibraryMethod("at", 0x51, new System.Delegate[] { @@ -4818,7 +4816,7 @@ }); module.DefineLibraryMethod("compact", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Compact), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Compact), }); module.DefineLibraryMethod("compact!", 0x51, new System.Delegate[] { @@ -4830,12 +4828,12 @@ }); module.DefineLibraryMethod("delete", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Delete), - new System.Func(IronRuby.Builtins.IListOps.Delete), + new System.Func(IronRuby.Builtins.IListOps.Delete), + new System.Func(IronRuby.Builtins.IListOps.Delete), }); module.DefineLibraryMethod("delete_at", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.DeleteAt), + new System.Func(IronRuby.Builtins.IListOps.DeleteAt), }); module.DefineLibraryMethod("delete_if", 0x51, new System.Delegate[] { @@ -4859,32 +4857,31 @@ }); module.DefineLibraryMethod("fetch", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Fetch), new System.Func(IronRuby.Builtins.IListOps.Fetch), }); module.DefineLibraryMethod("fill", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.Fill), new System.Func(IronRuby.Builtins.IListOps.Fill), - new System.Func(IronRuby.Builtins.IListOps.Fill), - new System.Func(IronRuby.Builtins.IListOps.Fill), + new System.Func, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object, System.Object, System.Object, System.Collections.IList>(IronRuby.Builtins.IListOps.Fill), + new System.Func, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object, IronRuby.Builtins.Range, System.Collections.IList>(IronRuby.Builtins.IListOps.Fill), new System.Func(IronRuby.Builtins.IListOps.Fill), new System.Func(IronRuby.Builtins.IListOps.Fill), - new System.Func(IronRuby.Builtins.IListOps.Fill), - new System.Func(IronRuby.Builtins.IListOps.Fill), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.IList, System.Object, System.Object, System.Object>(IronRuby.Builtins.IListOps.Fill), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.IList, IronRuby.Builtins.Range, System.Object>(IronRuby.Builtins.IListOps.Fill), }); module.DefineLibraryMethod("first", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.First), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.First), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.First), }); module.DefineLibraryMethod("flatten", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Flatten), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Flatten), }); module.DefineLibraryMethod("flatten!", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.FlattenInPlace), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.FlattenInPlace), }); module.DefineLibraryMethod("hash", 0x51, new System.Delegate[] { @@ -4892,19 +4889,19 @@ }); module.DefineLibraryMethod("include?", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Include), + new System.Func(IronRuby.Builtins.IListOps.Include), }); module.DefineLibraryMethod("index", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Index), + new System.Func(IronRuby.Builtins.IListOps.Index), }); module.DefineLibraryMethod("indexes", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], System.Object>(IronRuby.Builtins.IListOps.Indexes), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], System.Object>(IronRuby.Builtins.IListOps.Indexes), }); module.DefineLibraryMethod("indices", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], System.Object>(IronRuby.Builtins.IListOps.Indexes), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], System.Object>(IronRuby.Builtins.IListOps.Indexes), }); module.DefineLibraryMethod("initialize_copy", 0x52, new System.Delegate[] { @@ -4920,13 +4917,13 @@ }); module.DefineLibraryMethod("join", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Join), - new System.Func(IronRuby.Builtins.IListOps.Join), + new System.Func(IronRuby.Builtins.IListOps.Join), + new System.Func(IronRuby.Builtins.IListOps.Join), }); module.DefineLibraryMethod("last", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.Last), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.Last), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.Last), }); module.DefineLibraryMethod("length", 0x51, new System.Delegate[] { @@ -4950,7 +4947,7 @@ }); module.DefineLibraryMethod("rassoc", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.GetContainerOfSecondItem), + new System.Func(IronRuby.Builtins.IListOps.GetContainerOfSecondItem), }); module.DefineLibraryMethod("reject!", 0x51, new System.Delegate[] { @@ -4970,7 +4967,7 @@ }); module.DefineLibraryMethod("rindex", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.ReverseIndex), + new System.Func(IronRuby.Builtins.IListOps.ReverseIndex), }); module.DefineLibraryMethod("shift", 0x51, new System.Delegate[] { @@ -4983,22 +4980,22 @@ module.DefineLibraryMethod("slice", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.GetElement), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElements), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElement), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElements), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Collections.IList>(IronRuby.Builtins.IListOps.GetElement), }); module.DefineLibraryMethod("slice!", 0x51, new System.Delegate[] { new System.Func(IronRuby.Builtins.IListOps.SliceInPlace), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Object>(IronRuby.Builtins.IListOps.SliceInPlace), - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.SliceInPlace), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, IronRuby.Builtins.Range, System.Object>(IronRuby.Builtins.IListOps.SliceInPlace), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Int32, System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.SliceInPlace), }); module.DefineLibraryMethod("sort", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Sort), + new System.Func>, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.BinaryOpStorage, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Sort), }); module.DefineLibraryMethod("sort!", 0x51, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.SortInPlace), + new System.Func(IronRuby.Builtins.IListOps.SortInPlace), }); module.DefineLibraryMethod("to_a", 0x51, new System.Delegate[] { @@ -5010,7 +5007,7 @@ }); module.DefineLibraryMethod("to_s", 0x51, new System.Delegate[] { - new System.Func(IronRuby.Builtins.IListOps.Join), + new System.Func(IronRuby.Builtins.IListOps.Join), }); module.DefineLibraryMethod("transpose", 0x51, new System.Delegate[] { @@ -5018,7 +5015,7 @@ }); module.DefineLibraryMethod("uniq", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Unique), + new System.Func>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Collections.IList>(IronRuby.Builtins.IListOps.Unique), }); module.DefineLibraryMethod("uniq!", 0x51, new System.Delegate[] { @@ -5030,7 +5027,7 @@ }); module.DefineLibraryMethod("values_at", 0x51, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.IListOps.ValuesAt), + new System.Func, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Collections.IList, System.Object[], IronRuby.Builtins.RubyArray>(IronRuby.Builtins.IListOps.ValuesAt), }); } @@ -5405,7 +5402,7 @@ new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), - new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object[], System.DateTime>(IronRuby.Builtins.TimeOps.CreateGmtTime), }); module.DefineLibraryMethod("local", 0x61, new System.Delegate[] { @@ -5416,7 +5413,7 @@ new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), - new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object[], System.DateTime>(IronRuby.Builtins.TimeOps.CreateLocalTime), }); module.DefineLibraryMethod("mktime", 0x61, new System.Delegate[] { @@ -5427,7 +5424,7 @@ new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), - new System.Func(IronRuby.Builtins.TimeOps.CreateLocalTime), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object[], System.DateTime>(IronRuby.Builtins.TimeOps.CreateLocalTime), }); module.DefineLibraryMethod("now", 0x61, new System.Delegate[] { @@ -5446,7 +5443,7 @@ new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), - new System.Func(IronRuby.Builtins.TimeOps.CreateGmtTime), + new System.Func, IronRuby.Runtime.RubyContext, System.Object, System.Object[], System.DateTime>(IronRuby.Builtins.TimeOps.CreateGmtTime), }); } @@ -5779,23 +5776,23 @@ #endif #if !SILVERLIGHT IronRuby.Builtins.RubyClass def1 = DefineGlobalClass("Socket", typeof(IronRuby.StandardLibrary.Sockets.RubySocket), true, def3, new System.Action(LoadSocket_Instance), new System.Action(LoadSocket_Class), IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.CreateSocket), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, System.Object, System.Int32, System.Int32, IronRuby.StandardLibrary.Sockets.RubySocket>(IronRuby.StandardLibrary.Sockets.RubySocket.CreateSocket), }); #endif #if !SILVERLIGHT IronRuby.Builtins.RubyClass def4 = DefineGlobalClass("TCPSocket", typeof(IronRuby.StandardLibrary.Sockets.TCPSocket), true, def5, null, new System.Action(LoadTCPSocket_Class), IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.TCPSocket.CreateTCPSocket), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, System.Object, IronRuby.StandardLibrary.Sockets.TCPSocket>(IronRuby.StandardLibrary.Sockets.TCPSocket.CreateTCPSocket), }); #endif #if !SILVERLIGHT DefineGlobalClass("UDPSocket", typeof(IronRuby.StandardLibrary.Sockets.UDPSocket), true, def5, new System.Action(LoadUDPSocket_Instance), null, IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.CreateUDPSocket), - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.CreateUDPSocket), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, System.Object, IronRuby.StandardLibrary.Sockets.UDPSocket>(IronRuby.StandardLibrary.Sockets.UDPSocket.CreateUDPSocket), }); #endif #if !SILVERLIGHT DefineGlobalClass("TCPServer", typeof(IronRuby.StandardLibrary.Sockets.TCPServer), true, def4, new System.Action(LoadTCPServer_Instance), null, IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.TCPServer.CreateTCPServer), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, System.Object, IronRuby.StandardLibrary.Sockets.TCPServer>(IronRuby.StandardLibrary.Sockets.TCPServer.CreateTCPServer), }); #endif #if !SILVERLIGHT && !SILVERLIGHT @@ -5823,31 +5820,29 @@ }); module.DefineLibraryMethod("getsockopt", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.GetSocketOption), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, System.Int32, System.Int32, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.GetSocketOption), }); module.DefineLibraryMethod("recv", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Receive), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, System.Int32, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Receive), }); module.DefineLibraryMethod("recv_nonblock", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.ReceiveNonBlocking), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, System.Int32, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.ReceiveNonBlocking), }); module.DefineLibraryMethod("send", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Send), - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Send), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, IronRuby.Builtins.MutableString, System.Object, System.Int32>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Send), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, IronRuby.Builtins.MutableString, System.Object, IronRuby.Builtins.MutableString, System.Int32>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Send), }); module.DefineLibraryMethod("setsockopt", 0x11, new System.Delegate[] { - new System.Action(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), - new System.Action(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), - new System.Action(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), + new System.Action, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, System.Int32, System.Int32, System.Int32>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), + new System.Action, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, System.Int32, System.Int32, System.Boolean>(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), + new System.Action(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.SetSocketOption), }); module.DefineLibraryMethod("shutdown", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Shutdown), - new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Shutdown), new System.Func(IronRuby.StandardLibrary.Sockets.RubyBasicSocket.Shutdown), }); @@ -5883,8 +5878,7 @@ }); module.DefineLibraryMethod("recvfrom", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.IPSocket.ReceiveFrom), - new System.Func(IronRuby.StandardLibrary.Sockets.IPSocket.ReceiveFrom), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.IPSocket, System.Int32, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.IPSocket.ReceiveFrom), }); } @@ -6048,8 +6042,8 @@ }); module.DefineLibraryMethod("recvfrom", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.ReceiveFrom), - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.ReceiveFrom), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubySocket, System.Int32, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.RubySocket.ReceiveFrom), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubySocket, System.Int32, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.RubySocket.ReceiveFrom), }); module.DefineLibraryMethod("sysaccept", 0x11, new System.Delegate[] { @@ -6062,11 +6056,11 @@ #if !SILVERLIGHT private void LoadSocket_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("getaddrinfo", 0x21, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.GetAddressInfo), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyClass, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.RubySocket.GetAddressInfo), }); module.DefineLibraryMethod("gethostbyaddr", 0x21, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.GetHostByAddress), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.RubySocket.GetHostByAddress), }); module.DefineLibraryMethod("gethostbyname", 0x21, new System.Delegate[] { @@ -6078,7 +6072,7 @@ }); module.DefineLibraryMethod("getnameinfo", 0x21, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.GetNameInfo), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, IronRuby.Builtins.RubyArray, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.RubySocket.GetNameInfo), new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.GetNameInfo), }); @@ -6087,7 +6081,7 @@ }); module.DefineLibraryMethod("pack_sockaddr_in", 0x21, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.PackInetSockAddr), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, System.Object, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Sockets.RubySocket.PackInetSockAddr), }); module.DefineLibraryMethod("pair", 0x21, new System.Delegate[] { @@ -6095,7 +6089,7 @@ }); module.DefineLibraryMethod("sockaddr_in", 0x21, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.RubySocket.PackInetSockAddr), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Builtins.RubyClass, System.Object, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Sockets.RubySocket.PackInetSockAddr), }); module.DefineLibraryMethod("socketpair", 0x21, new System.Delegate[] { @@ -6278,22 +6272,22 @@ private void LoadUDPSocket_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("bind", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.Bind), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.UDPSocket, System.Object, System.Object, System.Int32>(IronRuby.StandardLibrary.Sockets.UDPSocket.Bind), }); module.DefineLibraryMethod("connect", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.Connect), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.UDPSocket, System.Object, System.Object, System.Int32>(IronRuby.StandardLibrary.Sockets.UDPSocket.Connect), }); module.DefineLibraryMethod("recvfrom_nonblock", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.ReceiveFromNonBlocking), - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.ReceiveFromNonBlocking), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.IPSocket, System.Int32, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.UDPSocket.ReceiveFromNonBlocking), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.IPSocket, System.Int32, System.Object, IronRuby.Builtins.RubyArray>(IronRuby.StandardLibrary.Sockets.UDPSocket.ReceiveFromNonBlocking), }); module.DefineLibraryMethod("send", 0x11, new System.Delegate[] { - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), - new System.Func(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), + new System.Func, IronRuby.Runtime.ConversionStorage, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, IronRuby.Builtins.MutableString, System.Object, System.Object, System.Object, System.Int32>(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, IronRuby.Builtins.MutableString, System.Object, System.Int32>(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), + new System.Func, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.Sockets.RubyBasicSocket, IronRuby.Builtins.MutableString, System.Object, IronRuby.Builtins.MutableString, System.Int32>(IronRuby.StandardLibrary.Sockets.UDPSocket.Send), }); } @@ -6440,12 +6434,12 @@ private void LoadDigest__Class_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("digest", 0x21, new System.Delegate[] { - new System.Func>>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Class.Digest), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Class.Digest), new System.Func(IronRuby.StandardLibrary.Digest.Digest.Class.Digest), }); module.DefineLibraryMethod("hexdigest", 0x21, new System.Delegate[] { - new System.Func>>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Class.HexDigest), + new System.Func>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Class.HexDigest), new System.Func(IronRuby.StandardLibrary.Digest.Digest.Class.HexDigest), }); @@ -6454,21 +6448,21 @@ private void LoadDigest__Instance_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("digest", 0x11, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.Digest), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.Digest), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.Digest), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.Digest), }); module.DefineLibraryMethod("digest!", 0x11, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.DigestNew), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.DigestNew), }); module.DefineLibraryMethod("hexdigest", 0x11, new System.Delegate[] { - new System.Func>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigest), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigest), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigest), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigest), }); module.DefineLibraryMethod("hexdigest!", 0x11, new System.Delegate[] { - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigestNew), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Runtime.RubyContext, System.Object, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Digest.Digest.Instance.HexDigestNew), }); } @@ -6490,7 +6484,7 @@ IronRuby.Builtins.RubyClass def7 = DefineClass("Zlib::ZStream", typeof(IronRuby.StandardLibrary.Zlib.Zlib.ZStream), true, classRef1, new System.Action(LoadZlib__ZStream_Instance), null, IronRuby.Builtins.RubyModule.EmptyArray, null); IronRuby.Builtins.RubyClass def5 = DefineClass("Zlib::GzipReader", typeof(IronRuby.StandardLibrary.Zlib.Zlib.GZipReader), true, def3, new System.Action(LoadZlib__GzipReader_Instance), new System.Action(LoadZlib__GzipReader_Class), IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.Zlib.Zlib.GZipReader.Create), - new System.Func>>, IronRuby.Builtins.RubyClass, System.Object, IronRuby.StandardLibrary.Zlib.Zlib.GZipReader>(IronRuby.StandardLibrary.Zlib.Zlib.GZipReader.Create), + new System.Func(IronRuby.StandardLibrary.Zlib.Zlib.GZipReader.Create), }); IronRuby.Builtins.RubyClass def6 = DefineClass("Zlib::Inflate", typeof(IronRuby.StandardLibrary.Zlib.Zlib.Inflate), true, def7, new System.Action(LoadZlib__Inflate_Instance), new System.Action(LoadZlib__Inflate_Class), IronRuby.Builtins.RubyModule.EmptyArray, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.Zlib.Zlib.Inflate.Create), @@ -6568,7 +6562,7 @@ private void LoadZlib__Inflate_Class(IronRuby.Builtins.RubyModule/*!*/ module) { module.DefineLibraryMethod("inflate", 0x21, new System.Delegate[] { - new System.Func>>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Zlib.Zlib.Inflate.InflateStream), + new System.Func>, IronRuby.Runtime.CallSiteStorage>, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.StandardLibrary.Zlib.Zlib.Inflate.InflateStream), }); } @@ -6995,21 +6989,21 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), }); module.DefineLibraryMethod("%", 0x11, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.ModuloOp), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.ModuloOp), }); module.DefineLibraryMethod("*", 0x11, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), }); module.DefineLibraryMethod("**", 0x11, new System.Delegate[] { @@ -7032,7 +7026,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), }); module.DefineLibraryMethod("+@", 0x11, new System.Delegate[] { @@ -7044,7 +7038,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThan), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThan), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThan), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThan), }); module.DefineLibraryMethod("<=", 0x11, new System.Delegate[] { @@ -7052,7 +7046,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThanOrEqual), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThanOrEqual), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThanOrEqual), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.LessThanOrEqual), }); module.DefineLibraryMethod("<=>", 0x11, new System.Delegate[] { @@ -7060,7 +7054,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Compare), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Compare), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Compare), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Compare), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Compare), }); module.DefineLibraryMethod("==", 0x11, new System.Delegate[] { @@ -7068,7 +7062,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), - new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), }); module.DefineLibraryMethod("===", 0x11, new System.Delegate[] { @@ -7076,7 +7070,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), - new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), }); module.DefineLibraryMethod(">", 0x11, new System.Delegate[] { @@ -7084,7 +7078,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThan), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThan), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThan), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThan), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThan), }); module.DefineLibraryMethod(">=", 0x11, new System.Delegate[] { @@ -7092,7 +7086,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThanOrEqual), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThanOrEqual), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThanOrEqual), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThanOrEqual), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.GreaterThanOrEqual), }); module.DefineLibraryMethod("abs", 0x11, new System.Delegate[] { @@ -7103,12 +7097,12 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Int32, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Add), }); module.DefineLibraryMethod("ceil", 0x11, new System.Delegate[] { @@ -7131,7 +7125,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.DivMod), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.DivMod), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.DivMod), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.DivMod), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.DivMod), }); module.DefineLibraryMethod("eql?", 0x11, new System.Delegate[] { @@ -7139,7 +7133,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), - new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Equal), }); module.DefineLibraryMethod("exponent", 0x11, new System.Delegate[] { @@ -7178,8 +7172,8 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), - new System.Func>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Double, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Modulo), }); module.DefineLibraryMethod("mult", 0x11, new System.Delegate[] { @@ -7187,7 +7181,7 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Int32, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Multiply), }); module.DefineLibraryMethod("nan?", 0x11, new System.Delegate[] { @@ -7212,7 +7206,7 @@ module.DefineLibraryMethod("remainder", 0x11, new System.Delegate[] { new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Remainder), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Remainder), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Remainder), }); module.DefineLibraryMethod("round", 0x11, new System.Delegate[] { @@ -7237,12 +7231,12 @@ new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), - new System.Func>>, Microsoft.Scripting.Generation.SiteLocalStorage>>, IronRuby.Runtime.RubyContext, IronRuby.StandardLibrary.BigDecimal.BigDecimal, System.Object, System.Int32, System.Object>(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), + new System.Func(IronRuby.StandardLibrary.BigDecimal.BigDecimalOps.Subtract), }); module.DefineLibraryMethod("to_f", 0x11, new System.Delegate[] { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Protocols.cs;C659171 File: Protocols.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Protocols.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Protocols.cs;MoreSites4 @@ -13,12 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Collections.Generic; @@ -31,6 +25,7 @@ using Microsoft.Scripting.Generation; using IronRuby.Builtins; using IronRuby.Runtime.Calls; +using IronRuby.Compiler; namespace IronRuby.Runtime { /// @@ -48,7 +43,6 @@ _ToF = CallSite>.Create(RubySites.InstanceCallAction("to_f")), _ToI = CallSite>.Create(RubySites.InstanceCallAction("to_i")), _ToInt = CallSite>.Create(RubySites.InstanceCallAction("to_int")), - _ToS = CallSite>.Create(RubySites.InstanceCallAction("to_s")), _ToStr = CallSite>.Create(RubySites.InstanceCallAction("to_str")), _ToA = CallSite>.Create(RubySites.InstanceCallAction("to_a")), _ToAry = CallSite>.Create(RubySites.InstanceCallAction("to_ary")); @@ -93,14 +87,17 @@ #endregion - #region CastToString, AsString, TryConvertToString + #region CastToString, AsString, TryConvertToString, ObjectToString /// - /// Standard way to convert to a Ruby String, using to_str - /// - /// Checks if it's already a string, and if so returns it. - /// Then calls to_str if it exists, otherwise throw a TypeError + /// Converts an object to string using to_str protocol (). /// + public static MutableString/*!*/ CastToString(ConversionStorage/*!*/ stringCast, RubyContext/*!*/ context, object obj) { + var site = stringCast.GetSite(ConvertToStrAction.Instance); + return site.Target(site, context, obj); + } + + // TODO: remove public static MutableString/*!*/ CastToString(RubyContext/*!*/ context, object obj) { MutableString str = AsString(context, obj); if (str != null) { @@ -109,6 +106,7 @@ throw RubyExceptions.CannotConvertTypeToTargetType(context, obj, "String"); } + // TODO: remove public static MutableString[]/*!*/ CastToStrings(RubyContext/*!*/ context, object[]/*!*/ objs) { var result = new MutableString[objs.Length]; for (int i = 0; i < objs.Length; i++) { @@ -117,6 +115,7 @@ return result; } + // TODO: remove /// /// Standard way to convert to a Ruby String, using to_str /// @@ -141,25 +140,11 @@ } /// - /// Convert to string using to_s - /// - /// The behavior is different from the typical conversion protocol: - /// * it assumes that to to_s is defined, and just calls it - /// * if to_s returns a non-string value, we fall back to Kernel.ToString + /// Convert to string using to_s protocol (). /// - public static MutableString/*!*/ ConvertToString(RubyContext/*!*/ context, object obj) { - MutableString str = obj as MutableString; - if (str != null) { - return str; - } - - str = _ToS.Target(_ToS, context, obj) as MutableString; - if (str != null) { - return str; - } - - // fallback to Kernel#to_s if to_s returned a non-string - return KernelOps.ToS(context, obj); + public static MutableString/*!*/ ConvertToString(ConversionStorage/*!*/ tosStorage, RubyContext/*!*/ context, object obj) { + var site = tosStorage.GetSite(ConvertToSAction.Instance); + return site.Target(site, context, obj); } #endregion @@ -194,17 +179,21 @@ throw RubyExceptions.CannotConvertTypeToTargetType(context, value, "Float"); } - public static double ConvertStringToFloat(RubyContext context, MutableString value) { - try { - return double.Parse(value.ConvertToString(), System.Globalization.CultureInfo.InvariantCulture.NumberFormat); - } catch (FormatException x) { - MutableString valueString = RubySites.Inspect(context, value); - throw RubyExceptions.CreateArgumentError("invalid value for Float(): " + valueString.ConvertToString(), x); + + public static double ConvertStringToFloat(RubyContext/*!*/ context, MutableString/*!*/ value) { + double result; + bool complete; + if (Tokenizer.TryParseDouble(value.ConvertToString(), out result, out complete) && complete) { + return result; } + + MutableString valueString = RubySites.Inspect(context, value); + throw RubyExceptions.CreateArgumentError(String.Format("invalid value for Float(): {0}", valueString.ConvertToString())); } + #endregion - #region TryConvertToInteger, ConvertToInteger, AsInteger, CastToInteger, CastToFixnum, IsInteger, IntegerAsFixnum + #region ConvertToInteger, CastToInteger, CastToFixnum private static bool AsPrimitiveInteger(object obj, out int intValue, out BigInteger bigValue) { // TODO: All CLR primitive numeric types? @@ -227,13 +216,6 @@ return false; } - public static object/*!*/ ConvertToInteger(RubyContext/*!*/ context, object obj) { - int fixnum; - BigInteger bignum; - ConvertToInteger(context, obj, out fixnum, out bignum); - return (object)bignum ?? ScriptingRuntimeHelpers.Int32ToObject(fixnum); - } - /// /// Standard way to convert to a Ruby Integer, using to_int and to_i /// Trys to call to_int, followed by to_i (if implemented). @@ -268,82 +250,30 @@ /// /// Try to cast the object to an Integer using to_int - /// Returns null if the object doesn't implement to_int + /// Throws if the cast fails /// Can return either Bignum or Fixnum /// - public static bool AsInteger(RubyContext/*!*/ context, object obj, out int fixnum, out BigInteger bignum) { + public static void CastToInteger(RubyContext/*!*/ context, object obj, out int fixnum, out BigInteger bignum) { // Don't call to_int on types derived from Integer if (AsPrimitiveInteger(obj, out fixnum, out bignum)) { - return true; + return; } if (RubySites.RespondTo(context, obj, "to_int")) { object result = _ToInt.Target(_ToInt, context, obj); if (AsPrimitiveInteger(result, out fixnum, out bignum)) { - return true; + return; } throw RubyExceptions.InvalidValueForType(context, result, "Integer"); } - return false; - } - - /// - /// Converts an Integer to a Fixnum. - /// Don't call any conversion methods--just handles Fixnum & Bignum - /// - /// - /// true if value is an Integer, false otherwise - /// Throws a RangeError if value is a - /// BigInteger but can't be converted to a Fixnum - public static bool IntegerAsFixnum(object value, out int result) { - if (value is int) { - result = (int)value; - return true; - } - - var bignum = value as BigInteger; - if ((object)bignum != null) { - if (!bignum.AsInt32(out result)) { - throw RubyExceptions.CreateRangeError("bignum too big to convert into `long'"); - } - return true; - } - - result = 0; - return false; - } - - /// - /// Try to cast the object to an Integer using to_int - /// Throws if the cast fails - /// Can return either Bignum or Fixnum - /// - public static void CastToInteger(RubyContext/*!*/ context, object obj, out int fixnum, out BigInteger bignum) { - if (AsInteger(context, obj, out fixnum, out bignum)) { - return; - } - throw RubyExceptions.CannotConvertTypeToTargetType(context, obj, "Integer"); } - /// - /// Like CastToInteger, but converts the result to a Fixnum - /// - public static int CastToFixnum(RubyContext/*!*/ context, object obj) { - if (obj == null) { - throw RubyExceptions.CreateTypeError("no implicit conversion from nil to integer"); - } - - int fixnum; - BigInteger bignum; - CastToInteger(context, obj, out fixnum, out bignum); - if ((object)bignum != null && !bignum.AsInt32(out fixnum)) { - throw RubyExceptions.CreateRangeError("bignum too big to convert into `long'"); - } - - return fixnum; + public static int CastToFixnum(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, object obj) { + var site = conversionStorage.GetSite(ConvertToFixnumAction.Instance); + return site.Target(site, context, obj); } /// @@ -514,12 +444,12 @@ /// Try to compare the lhs and rhs. Throws and exception if comparison returns null. Returns -1/0/+1 otherwise. /// public static int Compare( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object lhs, object rhs) { - var compare = comparisonStorage.GetCallSite("<=>", 1); + var compare = comparisonStorage.GetCallSite("<=>"); var result = compare.Target(compare, context, lhs, rhs); if (result != null) { @@ -530,18 +460,18 @@ } public static int ConvertCompareResult( - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object/*!*/ result) { Debug.Assert(result != null); - var greaterThanSite = greaterThanStorage.GetCallSite(">", 1); + var greaterThanSite = greaterThanStorage.GetCallSite(">"); if (RubyOps.IsTrue(greaterThanSite.Target(greaterThanSite, context, result, 0))) { return 1; } - var lessThanSite = lessThanStorage.GetCallSite("<", 1); + var lessThanSite = lessThanStorage.GetCallSite("<"); if (RubyOps.IsTrue(lessThanSite.Target(lessThanSite, context, result, 0))) { return -1; } @@ -561,13 +491,13 @@ /// /// Protocol for determining value equality in Ruby (uses IsTrue protocol on result of == call) /// - public static bool IsEqual(RubyContext/*!*/ context, object lhs, object rhs) { - return IsTrue(RubySites.Equal(context, lhs, rhs)); + public static bool IsEqual(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, object lhs, object rhs) { + var site = equals.GetCallSite("=="); + return IsTrue(site.Target(site, context, lhs, rhs)); } - public static bool RespondTo(SiteLocalStorage/*!*/ respondToStorage, - RubyContext/*!*/ context, object target, string/*!*/ methodName) { - var site = respondToStorage.GetCallSite("respond_to?", 1); + public static bool RespondTo(RespondToStorage/*!*/ respondToStorage, RubyContext/*!*/ context, object target, string/*!*/ methodName) { + var site = respondToStorage.GetCallSite(); return IsTrue(site.Target(site, context, target, SymbolTable.StringToId(methodName))); } @@ -581,8 +511,8 @@ /// or returns something other than a pair of objects. /// public static object CoerceAndCompare( - SiteLocalStorage/*!*/ coercionStorage, - SiteLocalStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ coercionStorage, + BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, object self, object other) { object result; @@ -596,8 +526,8 @@ /// "coerce" method is not defined, throws a subclass of SystemException, or returns something other than a pair of objects. /// public static bool CoerceAndRelate( - SiteLocalStorage/*!*/ coercionStorage, - SiteLocalStorage/*!*/ comparisonStorage, string/*!*/ relationalOp, + BinaryOpStorage/*!*/ coercionStorage, + BinaryOpStorage/*!*/ comparisonStorage, string/*!*/ relationalOp, RubyContext/*!*/ context, object self, object other) { object result; @@ -615,8 +545,8 @@ /// "coerce" method is not defined, throws a subclass of SystemException, or returns something other than a pair of objects. /// public static object CoerceAndApply( - SiteLocalStorage/*!*/ coercionStorage, - SiteLocalStorage/*!*/ binaryOpStorage, string/*!*/ binaryOp, + BinaryOpStorage/*!*/ coercionStorage, + BinaryOpStorage/*!*/ binaryOpStorage, string/*!*/ binaryOp, RubyContext/*!*/ context, object self, object other) { object result; @@ -628,8 +558,8 @@ } private static bool TryCoerceAndApply( - SiteLocalStorage/*!*/ coercionStorage, - SiteLocalStorage/*!*/ binaryOpStorage, string/*!*/ binaryOp, + BinaryOpStorage/*!*/ coercionStorage, + BinaryOpStorage/*!*/ binaryOpStorage, string/*!*/ binaryOp, RubyContext/*!*/ context, object self, object other, out object result) { // doesn't call method_missing: @@ -647,7 +577,7 @@ } if (coercedValues != null && coercedValues.Count == 2) { - var compare = binaryOpStorage.GetCallSite(binaryOp, 1); + var compare = binaryOpStorage.GetCallSite(binaryOp); result = compare.Target(compare, context, coercedValues[0], coercedValues[1]); return true; } @@ -658,16 +588,6 @@ #endregion - #region Range - - public static void ConvertToIntegerRange(RubyContext/*!*/ context, Range/*!*/ range, out int begin, out int end, out bool excludeEnd) { - begin = Protocols.CastToFixnum(context, RubySites.RangeBegin(context, range)); - end = Protocols.CastToFixnum(context, RubySites.RangeEnd(context, range)); - excludeEnd = RubySites.RangeExcludeEnd(context, range); - } - - #endregion - #region CLR Types public static Type[]/*!*/ ToTypes(RubyContext/*!*/ context, object[]/*!*/ values) { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/BigDecimal/BigDecimalOps.cs;C659171 File: BigDecimalOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/BigDecimal/BigDecimalOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/BigDecimal/BigDecimalOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Reflection; using System.Runtime.CompilerServices; @@ -381,7 +378,7 @@ [RubyMethod("+")] [RubyMethod("add")] - public static object Add(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ opStorage, + public static object Add(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ opStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, opStorage, "+", context, self, other); } @@ -410,7 +407,7 @@ } [RubyMethod("add")] - public static object Add(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ opStorage, + public static object Add(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ opStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other, [DefaultProtocol]int n) { return Protocols.CoerceAndApply(coercionStorage, opStorage, "+", context, self, other); } @@ -441,7 +438,7 @@ [RubyMethod("-")] [RubyMethod("sub")] - public static object Subtract(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Subtract(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "-", context, self, other); } @@ -470,7 +467,7 @@ } [RubyMethod("sub")] - public static object Subtract(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Subtract(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other, [DefaultProtocol]int n) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "sub", context, self, other); } @@ -497,7 +494,7 @@ } [RubyMethod("*")] - public static object Multiply(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Multiply(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "*", context, self, other); } @@ -526,7 +523,7 @@ } [RubyMethod("mult")] - public static object Multiply(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Multiply(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other, [DefaultProtocol]int n) { // TODO: converts result to BigDecimal return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "mult", context, self, other); @@ -586,19 +583,19 @@ } [RubyMethod("modulo")] - public static object Modulo(SiteLocalStorage/*!*/ moduloStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, double other) { - var modulo = moduloStorage.GetCallSite("modulo", 1); + public static object Modulo(BinaryOpStorage/*!*/ moduloStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, double other) { + var modulo = moduloStorage.GetCallSite("modulo"); return modulo.Target(modulo, context, BigDecimal.ToFloat(GetConfig(context), self), other); } [RubyMethod("%")] - public static object ModuloOp(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object ModuloOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "%", context, self, other); } [RubyMethod("modulo")] - public static object Modulo(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Modulo(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "modulo", context, self, other); } @@ -646,7 +643,7 @@ } [RubyMethod("divmod")] - public static object DivMod(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object DivMod(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "divmod", context, self, other); } @@ -666,7 +663,7 @@ } [RubyMethod("remainder")] - public static object Remainder(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Remainder(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "remainder", context, self, other); } @@ -710,7 +707,7 @@ } [RubyMethod("<=>")] - public static object Compare(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object Compare(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndCompare(coercionStorage, comparisonStorage, context, self, other); } @@ -745,7 +742,7 @@ } [RubyMethod(">")] - public static object GreaterThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object GreaterThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">", context, self, other); } @@ -779,7 +776,7 @@ } [RubyMethod(">=")] - public static object GreaterThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object GreaterThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">=", context, self, other); } @@ -813,7 +810,7 @@ } [RubyMethod("<")] - public static object LessThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object LessThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<", context, self, other); } @@ -847,7 +844,7 @@ } [RubyMethod("<=")] - public static object LessThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object LessThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<=", context, self, other); } @@ -891,12 +888,12 @@ [RubyMethod("eql?")] // HACK - this is actually semantically wrong but is what the BigDecimal library does. [RubyMethod("==")] [RubyMethod("===")] - public static object Equal(RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { + public static object Equal(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, BigDecimal/*!*/ self, object other) { // This is a hack since normal numeric values do not return nil for nil (they return false) if (other == null) { return null; } - return Protocols.IsEqual(context, other, self); + return Protocols.IsEqual(equals, context, other, self); } #endregion =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs;C660056 File: ArrayOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs;C660056 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Collections.Generic; @@ -56,7 +53,7 @@ } [RubyConstructor] - public static object CreateArray(BlockParam block, RubyClass/*!*/ self, + public static object CreateArray(ConversionStorage/*!*/ conversionStorage, BlockParam block, RubyClass/*!*/ self, [NotNull]object/*!*/ arrayOrSize) { IList array = Protocols.AsArray(self.Context, arrayOrSize); @@ -65,7 +62,7 @@ return CreateArray(array); } - int size = Protocols.CastToFixnum(self.Context, arrayOrSize); + int size = Protocols.CastToFixnum(conversionStorage, self.Context, arrayOrSize); if (block != null) { return CreateArray(block, size); } else { @@ -74,7 +71,7 @@ } [RubyMethod("initialize", RubyMethodAttributes.PrivateInstance)] - public static object Reinitialize(RubyContext/*!*/ context, BlockParam block, RubyArray/*!*/ self, + public static object Reinitialize(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, BlockParam block, RubyArray/*!*/ self, [NotNull]object/*!*/ arrayOrSize) { RubyUtils.RequiresNotFrozen(context, self); @@ -84,7 +81,7 @@ return Reinitialize(self, array); } - int size = Protocols.CastToFixnum(context, arrayOrSize); + int size = Protocols.CastToFixnum(conversionStorage, context, arrayOrSize); if (block != null) { return Reinitialize(block, self, size); } else { @@ -232,7 +229,9 @@ #region pack [RubyMethod("pack")] - public static MutableString/*!*/ Pack(RubyContext/*!*/ context, RubyArray/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ format) { + public static MutableString/*!*/ Pack(ConversionStorage/*!*/ stringCast, + RubyContext/*!*/ context, RubyArray/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ format) { + using (MutableStringStream stream = new MutableStringStream()) { BinaryWriter writer = new BinaryWriter(stream); int i = 0; @@ -254,7 +253,7 @@ case 'a': case 'Z': count = 1; - char[] cstr = Protocols.CastToString(context, self[i]).ToString().ToCharArray(); + char[] cstr = Protocols.CastToString(stringCast, context, self[i]).ToString().ToCharArray(); int len1 = directive.Count.HasValue ? directive.Count.Value : cstr.Length; int len2 = (len1 > cstr.Length) ? cstr.Length : len1; writer.Write(cstr, 0, len2); @@ -332,7 +331,7 @@ case 'm': count = 1; - str = Protocols.CastToString(context, self[i]); + str = Protocols.CastToString(stringCast, context, self[i]); char[] base64 = Convert.ToBase64String(str.ToByteArray()).ToCharArray(); for (int j = 0; j < base64.Length; j += 60) { int len = base64.Length - j; @@ -373,7 +372,7 @@ case 'H': // MRI skips null, unlike in "m" directive: if (self[i] != null) { - str = Protocols.CastToString(context, self[i]); + str = Protocols.CastToString(stringCast, context, self[i]); FromHex(writer, str, directive.Count ?? str.GetByteCount(), directive.Directive == 'h'); } break; @@ -462,9 +461,9 @@ [RubyMethod("sort")] public static RubyArray/*!*/ Sort( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam block, RubyArray/*!*/ self) { RubyArray result = self.CreateInstance(); @@ -474,9 +473,9 @@ [RubyMethod("sort!")] public static RubyArray/*!*/ SortInPlace( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam block, RubyArray/*!*/ self) { RubyUtils.RequiresNotFrozen(context, self); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;C659171 File: BigNumOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using IronRuby.Runtime; using Microsoft.Scripting.Generation; @@ -87,7 +84,7 @@ /// self + other /// Coerces self and other using other.coerce(self) then dynamically invokes + [RubyMethod("+")] - public static object Add(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Add(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "+", context, self, other); } @@ -121,7 +118,7 @@ /// self - other /// Coerces self and other using other.coerce(self) then dynamically invokes - [RubyMethod("-")] - public static object Subtract(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Subtract(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "-", context, self, other); } @@ -155,7 +152,7 @@ /// self * other /// Coerces self and other using other.coerce(self) then dynamically invokes * [RubyMethod("*")] - public static object Multiply(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Multiply(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "*", context, self, other); } @@ -189,7 +186,7 @@ /// self / other /// Coerces self and other using other.coerce(self) then dynamically invokes / [RubyMethod("/")] - public static object Divide(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Divide(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "/", context, self, other); } @@ -200,7 +197,7 @@ /// self.div(other) /// Coerces self and other using other.coerce(self) then dynamically invokes div [RubyMethod("div")] - public static object Div(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Div(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "div", context, self, other); } @@ -235,7 +232,7 @@ /// self divided by other as Float /// Coerces self and other using other.coerce(self) then dynamically invokes quo [RubyMethod("quo")] - public static object Quotient(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Quotient(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "quo", context, self, other); } @@ -289,7 +286,7 @@ /// self ** exponent /// Coerces self and other using other.coerce(self) then dynamically invokes ** [RubyMethod("**")] - public static object Power(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Power(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object exponent) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "**", context, self, exponent); } @@ -315,7 +312,7 @@ /// self % other, as Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes % [RubyMethod("%")] - public static object ModuloOp(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object ModuloOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "%", context, self, other); } @@ -326,7 +323,7 @@ /// self modulo other, as Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes modulo [RubyMethod("modulo")] - public static object Modulo(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Modulo(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "modulo", context, self, other); } @@ -363,7 +360,7 @@ /// Should return [self div other, self modulo other], but the divmod implementation is free to return an arbitrary object. /// Coerces self and other using other.coerce(self) then dynamically invokes divmod [RubyMethod("divmod")] - public static object DivMod(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object DivMod(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "divmod", context, self, other); } @@ -395,7 +392,7 @@ /// Float, Fixnum or Bignum /// Coerces self and other using other.coerce(self) then dynamically invokes remainder [RubyMethod("remainder")] - public static object Remainder(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Remainder(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "remainder", context, self, other); } @@ -444,7 +441,7 @@ /// Dynamically invokes <=>. /// [RubyMethod("<=>")] - public static object Compare(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object Compare(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { return Protocols.CoerceAndCompare(coercionStorage, comparisonStorage, context, self, other); } @@ -481,9 +478,9 @@ /// true or false /// Dynamically invokes other == self (i.e. swaps self and other around) [RubyMethod("==")] - public static bool Equal(RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { + public static bool Equal(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, BigInteger/*!*/ self, object other) { // If we can't convert then swap self and other and try again. - return Protocols.IsEqual(context, other, self); + return Protocols.IsEqual(equals, context, other, self); } #endregion =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Comparable.cs;C659171 File: Comparable.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Comparable.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Comparable.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using IronRuby.Runtime; using IronRuby.Runtime.Calls; @@ -28,9 +25,9 @@ public static class Comparable { [RubyMethod("<")] public static bool Less( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object self, object other) { return Compare(compareStorage, lessThanStorage, greaterThanStorage, context, self, other).GetValueOrDefault(0) < 0; @@ -38,9 +35,9 @@ [RubyMethod("<=")] public static bool LessOrEqual( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object self, object other) { return Compare(compareStorage, lessThanStorage, greaterThanStorage, context, self, other).GetValueOrDefault(1) <= 0; @@ -48,9 +45,9 @@ [RubyMethod(">=")] public static bool GreaterOrEqual( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object self, object other) { return Compare(compareStorage, lessThanStorage, greaterThanStorage, context, self, other).GetValueOrDefault(-1) >= 0; @@ -58,9 +55,9 @@ [RubyMethod(">")] public static bool Greater( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object self, object other) { return Compare(compareStorage, lessThanStorage, greaterThanStorage, context, self, other).GetValueOrDefault(0) > 0; @@ -70,13 +67,13 @@ /// Try to compare the lhs and rhs. Throws and exception if comparison returns null. Returns null on failure, -1/0/+1 otherwise. /// private static int? Compare( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object lhs, object rhs) { // calls method_missing, doesn't catch any exception: - var compare = compareStorage.GetCallSite("<=>", 1); + var compare = compareStorage.GetCallSite("<=>"); object compareResult = compare.Target(compare, context, lhs, rhs); if (compareResult != null) { @@ -88,9 +85,9 @@ [RubyMethod("between?")] public static bool Between( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, object self, object min, object max) { return !Less(compareStorage, lessThanStorage, greaterThanStorage, context, self, min) @@ -98,7 +95,7 @@ } [RubyMethod("==")] - public static object Equal(SiteLocalStorage/*!*/ compareStorage, + public static object Equal(BinaryOpStorage/*!*/ compareStorage, RubyContext/*!*/ context, object self, object other) { if (self == other) { @@ -106,7 +103,7 @@ } // calls method_missing: - var compare = compareStorage.GetCallSite("<=>", 1); + var compare = compareStorage.GetCallSite("<=>"); object compareResult; try { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Enumerable.cs;C659171 File: Enumerable.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Enumerable.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Enumerable.cs;MoreSites4 @@ -13,10 +13,6 @@ * * ***************************************************************************/ -using Enumerator = IronRuby.StandardLibrary.Enumerator.Enumerable.Enumerator; -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Collections.Generic; @@ -26,7 +22,11 @@ using IronRuby.Runtime; using Microsoft.Scripting.Generation; using Microsoft.Scripting.Runtime; +using IronRuby.Runtime.Calls; +using Enumerator = IronRuby.StandardLibrary.Enumerator.Enumerable.Enumerator; +using EachSite = System.Func; + namespace IronRuby.Builtins { // TODO: All of these methods use RubySites.Each, which is not ideal (shared DynamicSite). @@ -34,30 +34,31 @@ // "each" site to be merged into the calling site (e.g. maybe use ActionOnCallable) [RubyModule("Enumerable")] public static class Enumerable { - - private static object Each(RubyContext/*!*/ context, object self, Proc/*!*/ block) { - if (self is Enumerator) { - return ((Enumerator)self).Each(context, block); + private static object Each(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, object self, Proc/*!*/ block) { + var enumerator = self as Enumerator; + if (enumerator != null) { + return enumerator.Each(context, block); } else { - return RubySites.Each(context, self, block); + var site = each.GetCallSite("each", RubyCallSignature.WithBlock(0)); + return site.Target(site, context, self, block); } } #region all?, any? [RubyMethod("all?")] - public static object TrueForAll(RubyContext/*!*/ context, BlockParam predicate, object self) { - return TrueForItems(context, predicate, self, true); + public static object TrueForAll(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self) { + return TrueForItems(each, context, predicate, self, true); } [RubyMethod("any?")] - public static object TrueForAny(RubyContext/*!*/ context, BlockParam predicate, object self) { - return TrueForItems(context, predicate, self, false); + public static object TrueForAny(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self) { + return TrueForItems(each, context, predicate, self, false); } - private static object TrueForItems(RubyContext/*!*/ context, BlockParam predicate, object self, bool expected) { + private static object TrueForItems(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self, bool expected) { bool result = expected; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (predicate != null) { if (predicate.Yield(item, out item)) { return item; @@ -82,9 +83,9 @@ [RubyMethod("collect")] [RubyMethod("map")] - public static RubyArray Map(RubyContext/*!*/ context, BlockParam collector, object self) { + public static RubyArray Map(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam collector, object self) { RubyArray result = new RubyArray(); - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (collector != null) { if (collector.Yield(item, out item)) { return item; @@ -102,11 +103,12 @@ [RubyMethod("detect")] [RubyMethod("find")] - public static object Find(SiteLocalStorage>>/*!*/ callStorage, + public static object Find(CallSiteStorage/*!*/ each, + CallSiteStorage>/*!*/ callStorage, RubyContext/*!*/ context, BlockParam predicate, object self, [Optional]object ifNone) { object result = Missing.Value; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (predicate == null) { throw RubyExceptions.NoBlockGiven(); } @@ -141,7 +143,7 @@ #region each_with_index [RubyMethod("each_with_index")] - public static object EachWithIndex(RubyContext/*!*/ context, BlockParam/*!*/ block, object self) { + public static object EachWithIndex(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam/*!*/ block, object self) { // for some reason each_with_index always checks for a block, even if there's nothing to yield if (block == null) { throw RubyExceptions.NoBlockGiven(); @@ -149,7 +151,7 @@ int index = 0; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { object blockResult; if (block.Yield(item, index, out blockResult)) { return blockResult; @@ -167,10 +169,10 @@ [RubyMethod("entries")] [RubyMethod("to_a")] - public static RubyArray/*!*/ ToArray(RubyContext/*!*/ context, object self) { + public static RubyArray/*!*/ ToArray(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, object self) { RubyArray data = new RubyArray(); - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { data.Add(item); return null; })); @@ -184,19 +186,21 @@ [RubyMethod("find_all")] [RubyMethod("select")] - public static RubyArray/*!*/ Select(RubyContext/*!*/ context, BlockParam predicate, object self) { - return Filter(context, predicate, self, true); + public static RubyArray/*!*/ Select(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self) { + return Filter(each, context, predicate, self, true); } [RubyMethod("reject")] - public static RubyArray/*!*/ Reject(RubyContext/*!*/ context, BlockParam predicate, object self) { - return Filter(context, predicate, self, false); + public static RubyArray/*!*/ Reject(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self) { + return Filter(each, context, predicate, self, false); } - private static RubyArray/*!*/ Filter(RubyContext/*!*/ context, BlockParam predicate, object self, bool acceptingValue) { + private static RubyArray/*!*/ Filter(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, + BlockParam predicate, object self, bool acceptingValue) { + RubyArray result = new RubyArray(); - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (predicate == null) { throw RubyExceptions.NoBlockGiven(); } @@ -221,11 +225,13 @@ #region grep [RubyMethod("grep")] - public static RubyArray Grep(RubyContext/*!*/ context, BlockParam action, object self, object pattern) { + public static RubyArray Grep(CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ caseEquals, RubyContext/*!*/ context, BlockParam action, object self, object pattern) { RubyArray result = new RubyArray(); + var site = caseEquals.GetCallSite("==="); - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { - if (RubySites.CaseEqual(context, pattern, item)) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + if (RubyOps.IsTrue(site.Target(site, context, pattern, item))) { if (action != null) { if (action.Yield(item, out item)) { return item; @@ -245,11 +251,12 @@ [RubyMethod("include?")] [RubyMethod("member?")] - public static bool Contains(RubyContext/*!*/ context, object self, object value) { + public static bool Contains(CallSiteStorage/*!*/ each, BinaryOpStorage/*!*/ equals, + RubyContext/*!*/ context, object self, object value) { bool result = false; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { - if (Protocols.IsEqual(context, item, value)) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + if (Protocols.IsEqual(equals, context, item, value)) { result = true; return selfBlock.Break(result); } @@ -264,10 +271,11 @@ #region inject [RubyMethod("inject")] - public static object Inject(RubyContext/*!*/ context, BlockParam operation, object self, [Optional]object initial) { + public static object Inject(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, + BlockParam operation, object self, [Optional]object initial) { + object result = initial; - - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (result == Missing.Value) { result = item; return null; @@ -293,32 +301,35 @@ [RubyMethod("max")] public static object GetMaximum( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam comparer, object self) { - return GetExtreme(compareStorage, lessThanStorage, greaterThanStorage, context, comparer, self, -1/*look for max*/); + return GetExtreme(each, compareStorage, lessThanStorage, greaterThanStorage, context, comparer, self, -1/*look for max*/); } [RubyMethod("min")] public static object GetMinimum( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam comparer, object self) { - return GetExtreme(compareStorage, lessThanStorage, greaterThanStorage, context, comparer, self, 1/*look for min*/); + return GetExtreme(each, compareStorage, lessThanStorage, greaterThanStorage, context, comparer, self, 1/*look for min*/); } private static object GetExtreme( - SiteLocalStorage/*!*/ compareStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ compareStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam comparer, object self, int comparisonValue) { bool firstItem = true; object result = null; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { // Check for first element if (firstItem) { result = item; @@ -356,11 +367,11 @@ #region partition [RubyMethod("partition")] - public static RubyArray/*!*/ Partition(RubyContext/*!*/ context, BlockParam predicate, object self) { + public static RubyArray/*!*/ Partition(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam predicate, object self) { RubyArray trueSet = new RubyArray(); RubyArray falseSet = new RubyArray(); - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (predicate == null) { throw RubyExceptions.NoBlockGiven(); } @@ -391,26 +402,28 @@ [RubyMethod("sort")] public static object Sort( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - + CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam keySelector, object self) { - return ArrayOps.SortInPlace(comparisonStorage, lessThanStorage, greaterThanStorage, context, keySelector, ToArray(context, self)); + + return ArrayOps.SortInPlace(comparisonStorage, lessThanStorage, greaterThanStorage, context, keySelector, ToArray(each, context, self)); } [RubyMethod("sort_by")] public static RubyArray/*!*/ SortBy( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + CallSiteStorage/*!*/ each, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam keySelector, object self) { // collect key, value pairs List> keyValuePairs = new List>(); // Collect the key, value pairs - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { if (keySelector == null) { throw RubyExceptions.NoBlockGiven(); } @@ -443,7 +456,8 @@ #region zip [RubyMethod("zip")] - public static RubyArray/*!*/ Zip(RubyContext/*!*/ context, BlockParam block, object self, [NotNull]params object[] args) { + public static RubyArray/*!*/ Zip(CallSiteStorage/*!*/ each, RubyContext/*!*/ context, BlockParam block, + object self, [NotNull]params object[] args) { RubyArray results = (block == null) ? new RubyArray() : null; // Call to_a on each argument @@ -453,7 +467,7 @@ } int index = 0; - Each(context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { + Each(each, context, self, Proc.Create(context, delegate(BlockParam/*!*/ selfBlock, object item) { // Collect items RubyArray array = new RubyArray(otherArrays.Length + 1); array.Add(item); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/EnvironmentSingletonOps.cs;C633889 File: EnvironmentSingletonOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/EnvironmentSingletonOps.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/EnvironmentSingletonOps.cs;MoreSites4 @@ -241,31 +241,29 @@ return null; } - private static List> ExtractHash(RubyContext/*!*/ context, Hash/*!*/ values) { - var result = new List>(values.Count); - foreach (var pair in values) { - result.Add(new KeyValuePair( - Protocols.CastToString(context, pair.Key).ToString(), - Protocols.CastToString(context, pair.Value).ToString() - )); - } - return result; - } - - private static void Update(RubyContext/*!*/ context, List>/*!*/ values) { + private static void Update(ConversionStorage/*!*/ stringCast, RubyContext/*!*/ context, Hash/*!*/ values) { PlatformAdaptationLayer pal = context.DomainManager.Platform; foreach (var pair in values) { - pal.SetEnvironmentVariable(pair.Key, pair.Value); + var name = Protocols.CastToString(stringCast, context, pair.Key).ToString(); + var value = Protocols.CastToString(stringCast, context, pair.Value).ToString(); + + pal.SetEnvironmentVariable(name, value); } } [RubyMethod("replace")] - public static object/*!*/ Replace(RubyContext/*!*/ context, object/*!*/ self, [NotNull]Hash/*!*/ values) { + public static object/*!*/ Replace(ConversionStorage/*!*/ stringCast, RubyContext/*!*/ context, object/*!*/ self, [NotNull]Hash/*!*/ values) { Clear(context, self); - Update(context, ExtractHash(context, values)); + Update(stringCast, context, values); return self; } + [RubyMethod("update")] + public static object/*!*/ Update(ConversionStorage/*!*/ stringCast, RubyContext/*!*/ context, object/*!*/ self, [NotNull]Hash/*!*/ values) { + Update(stringCast, context, values); + return self; + } + [RubyMethod("shift")] public static object Shift(RubyContext/*!*/ context, object/*!*/ self) { PlatformAdaptationLayer pal = context.DomainManager.Platform; @@ -299,13 +297,6 @@ return MutableString.Create("ENV"); } - [RubyMethod("update")] - public static object/*!*/ Update(RubyContext/*!*/ context, object/*!*/ self, [NotNull]Hash/*!*/ values) { - Update(context, ExtractHash(context, values)); - return self; - } - - [RubyMethod("values")] public static RubyArray/*!*/ Values(RubyContext/*!*/ context, object/*!*/ self) { PlatformAdaptationLayer pal = context.DomainManager.Platform; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ExceptionOps.cs;C660056 File: ExceptionOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ExceptionOps.cs;C660056 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ExceptionOps.cs;MoreSites4 @@ -154,12 +154,13 @@ [RubyMethod("to_s")] [RubyMethod("to_str")] - public static MutableString/*!*/ GetMessage(RubyContext/*!*/ context, Exception/*!*/ self) { - return Protocols.AsString(context, GetMessage(self)); + public static MutableString/*!*/ GetMessage(ConversionStorage/*!*/ tosStorage, RubyContext/*!*/ context, Exception/*!*/ self) { + return Protocols.ConvertToString(tosStorage, context, GetMessage(self)); } [RubyMethod("inspect", RubyMethodAttributes.PublicInstance)] - public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, Exception/*!*/ self) { + public static MutableString/*!*/ Inspect(UnaryOpStorage/*!*/ inspectStorage, ConversionStorage/*!*/ tosStorage, + RubyContext/*!*/ context, Exception/*!*/ self) { object message = RubyExceptionData.GetInstance(self).Message; string className = RubyUtils.GetClassName(context, self); @@ -169,7 +170,7 @@ result.Append(className); result.Append(": "); if (message != null) { - result.Append(KernelOps.Inspect(context, message)); + result.Append(KernelOps.Inspect(inspectStorage, tosStorage, context, message)); } else { result.Append(className); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs;C633889 File: FileOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs;MoreSites4 @@ -20,6 +20,7 @@ using Microsoft.Scripting.Runtime; using IronRuby.Runtime; using IronRuby.Runtime.Calls; +using System.Diagnostics; namespace IronRuby.Builtins { @@ -65,7 +66,7 @@ #region Public Singleton Methods [RubyMethod("atime", RubyMethodAttributes.PublicSingleton)] - public static DateTime AccessTime(RubyClass/*!*/ self, object path) { + public static DateTime AccessTime(RubyClass/*!*/ self, [DefaultProtocol]MutableString/*!*/ path) { return RubyStatOps.AccessTime(RubyStatOps.Create(self.Context, path)); } @@ -135,17 +136,17 @@ } [RubyMethod("blockdev?", RubyMethodAttributes.PublicSingleton)] - public static bool IsBlockDevice(RubyClass/*!*/ self, object/*!*/ path) { + public static bool IsBlockDevice(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsBlockDevice(RubyStatOps.Create(self.Context, path)); } [RubyMethod("chardev?", RubyMethodAttributes.PublicSingleton)] - public static bool IsCharDevice(RubyClass/*!*/ self, object path) { + public static bool IsCharDevice(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsCharDevice(RubyStatOps.Create(self.Context, path)); } [RubyMethod("chmod", RubyMethodAttributes.PublicSingleton)] - public static int Chmod(RubyClass/*!*/ self, int permission, MutableString path) { + public static int Chmod(RubyClass/*!*/ self, int permission, [DefaultProtocol, NotNull]MutableString/*!*/ path) { // TODO: implement this correctly for windows return 0; } @@ -153,7 +154,7 @@ //chown [RubyMethod("ctime", RubyMethodAttributes.PublicSingleton)] - public static DateTime CreateTime(RubyClass/*!*/ self, object path) { + public static DateTime CreateTime(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.CreateTime(RubyStatOps.Create(self.Context, path)); } @@ -236,7 +237,7 @@ [RubyMethod("executable?", RubyMethodAttributes.PublicSingleton)] [RubyMethod("executable_real?", RubyMethodAttributes.PublicSingleton)] - public static bool IsExecutable(RubyClass/*!*/ self, object path) { + public static bool IsExecutable(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsExecutable(RubyStatOps.Create(self.Context, path)); } @@ -268,25 +269,26 @@ #endregion [RubyMethod("ftype", RubyMethodAttributes.PublicSingleton)] - public static MutableString FileType(RubyClass/*!*/ self, object path) { + public static MutableString FileType(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.FileType(RubyStatOps.Create(self.Context, path)); } [RubyMethod("grpowned?", RubyMethodAttributes.PublicSingleton)] - public static bool IsGroupOwned(RubyClass/*!*/ self, object path) { + public static bool IsGroupOwned(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsGroupOwned(RubyStatOps.Create(self.Context, path)); } //identical? [RubyMethod("join", RubyMethodAttributes.PublicSingleton)] - public static MutableString Join(RubyClass/*!*/ self, [NotNull]params object[] strings) { + public static MutableString Join(ConversionStorage/*!*/ stringCast, RubyClass/*!*/ self, [NotNull]params object[] strings) { MutableString result = MutableString.CreateMutable(); - for (int i = 0; i < strings.Length; ++i) { - result.Append(Protocols.ConvertToString(self.Context, strings[i])); - if (i < strings.Length - 1) + for (int i = 0; i < strings.Length; i++) { + result.Append(Protocols.CastToString(stringCast, self.Context, strings[i])); + if (i < strings.Length - 1) { result.Append(SEPARATOR); + } } return result; @@ -386,12 +388,12 @@ [RubyMethod("lstat", RubyMethodAttributes.PublicSingleton)] [RubyMethod("stat", RubyMethodAttributes.PublicSingleton)] - public static FileSystemInfo Stat(RubyClass/*!*/ self, object path) { + public static FileSystemInfo/*!*/ Stat(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.Create(self.Context, path); } [RubyMethod("mtime", RubyMethodAttributes.PublicSingleton)] - public static DateTime ModifiedTime(RubyClass/*!*/ self, object path) { + public static DateTime ModifiedTime(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.ModifiedTime(RubyStatOps.Create(self.Context, path)); } @@ -444,18 +446,18 @@ } [RubyMethod("owned?", RubyMethodAttributes.PublicSingleton)] - public static bool IsUserOwned(RubyClass/*!*/ self, object path) { + public static bool IsUserOwned(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsUserOwned(RubyStatOps.Create(self.Context, path)); } [RubyMethod("pipe?", RubyMethodAttributes.PublicSingleton)] - public static bool IsPipe(RubyClass/*!*/ self, object path) { + public static bool IsPipe(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsPipe(RubyStatOps.Create(self.Context, path)); } [RubyMethod("readable?", RubyMethodAttributes.PublicSingleton)] [RubyMethod("readable_real?", RubyMethodAttributes.PublicSingleton)] - public static bool IsReadable(RubyClass/*!*/ self, object path) { + public static bool IsReadable(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsReadable(RubyStatOps.Create(self.Context, path)); } @@ -479,27 +481,27 @@ } [RubyMethod("setgid?", RubyMethodAttributes.PublicSingleton)] - public static bool IsSetGid(RubyClass/*!*/ self, object path) { + public static bool IsSetGid(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsSetGid(RubyStatOps.Create(self.Context, path)); } [RubyMethod("setuid?", RubyMethodAttributes.PublicSingleton)] - public static bool IsSetUid(RubyClass/*!*/ self, object path) { + public static bool IsSetUid(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsSetUid(RubyStatOps.Create(self.Context, path)); } [RubyMethod("size", RubyMethodAttributes.PublicSingleton)] - public static int Size(RubyClass/*!*/ self, object path) { + public static int Size(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.Size(RubyStatOps.Create(self.Context, path)); } [RubyMethod("size?", RubyMethodAttributes.PublicSingleton)] - public static object NullableSize(RubyClass/*!*/ self, object path) { + public static object NullableSize(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.NullableSize(RubyStatOps.Create(self.Context, path)); } [RubyMethod("socket?", RubyMethodAttributes.PublicSingleton)] - public static bool IsSocket(RubyClass/*!*/ self, object path) { + public static bool IsSocket(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsSocket(RubyStatOps.Create(self.Context, path)); } @@ -512,7 +514,7 @@ } [RubyMethod("sticky?", RubyMethodAttributes.PublicSingleton)] - public static bool IsSticky(RubyClass/*!*/ self, object path) { + public static bool IsSticky(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsSticky(RubyStatOps.Create(self.Context, path)); } @@ -521,12 +523,12 @@ #if !SILVERLIGHT [RubyMethod("symlink", RubyMethodAttributes.PublicSingleton, BuildConfig = "!SILVERLIGHT")] - public static object SymLink(RubyClass/*!*/ self, object path) { + public static object SymLink(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { throw new NotImplementedError("symlnk() function is unimplemented on this machine"); } [RubyMethod("symlink?", RubyMethodAttributes.PublicSingleton, BuildConfig = "!SILVERLIGHT")] - public static bool IsSymLink(RubyClass/*!*/ self, object path) { + public static bool IsSymLink(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return RubyStatOps.IsSymLink(RubyStatOps.Create(self.Context, path)); } @@ -718,8 +720,8 @@ [RubyClass("Stat", Extends = typeof(FileSystemInfo), Inherits = typeof(object), BuildConfig = "!SILVERLIGHT"), Includes(typeof(Comparable))] public class RubyStatOps { - internal static FileSystemInfo/*!*/ Create(RubyContext/*!*/ context, object path) { - return Create(context, Protocols.CastToString(context, path).ConvertToString()); + internal static FileSystemInfo/*!*/ Create(RubyContext/*!*/ context, MutableString/*!*/ path) { + return Create(context, path.ConvertToString()); } internal static FileSystemInfo/*!*/ Create(RubyContext/*!*/ context, string/*!*/ path) { @@ -748,27 +750,19 @@ [RubyConstructor] - public static FileSystemInfo/*!*/ Create(RubyClass/*!*/ self, [NotNull]MutableString/*!*/ path) { - return Create(self.Context, path.ConvertToString()); - } - - [RubyConstructor] - public static FileSystemInfo/*!*/ Create(RubyClass/*!*/ self, object path) { + public static FileSystemInfo/*!*/ Create(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path) { return Create(self.Context, path); } [RubyMethod("<=>")] - public static int Compare(FileSystemInfo/*!*/ self, FileSystemInfo/*!*/ other) { + public static int Compare(FileSystemInfo/*!*/ self, [NotNull]FileSystemInfo/*!*/ other) { return TimeOps.CompareTo(self.LastWriteTime, other.LastWriteTime); } [RubyMethod("<=>")] public static object Compare(FileSystemInfo/*!*/ self, object other) { - FileSystemInfo otherStat = (other as FileSystemInfo); - if (otherStat == null) { - return null; - } - return Compare(self, otherStat); + Debug.Assert(other as FileSystemInfo == null); + return null; } [RubyMethod("atime")] =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;C659171 File: FixnumOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using Microsoft.Scripting; using Microsoft.Scripting.Runtime; @@ -50,7 +47,7 @@ /// /// Just returns the Fixnum [RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)] - public static int InducedFrom(RubyClass/*!*/ self, int obj) { + public static int InducedFrom(RubyClass/*!*/ self, [DefaultProtocol]int obj) { return obj; } @@ -64,19 +61,9 @@ if (obj <= Int32.MaxValue && obj >= Int32.MinValue) { return (int)obj; } - throw RubyExceptions.CreateRangeError("Float " + obj.ToString() + " out of range of integer"); + throw RubyExceptions.CreateRangeError(String.Format("Float {0} out of range of integer", obj)); } - /// - /// Convert obj to a Fixnum - /// - /// Dynamically invokes to_int on obj, unless obj is null. - /// If obj is Nil - [RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)] - public static int InducedFrom(RubyClass/*!*/ self, object obj) { - return Protocols.CastToFixnum(self.Context, Protocols.ConvertToInteger(self.Context, obj)); - } - #endregion #region size @@ -315,7 +302,7 @@ /// First coerces self on other then calls % on the coerced self value. /// [RubyMethod("%")] - public static object ModuloOp(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object ModuloOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "%", context, self, other); } @@ -327,7 +314,7 @@ /// First coerces self on other then calls modulo on the coerced self value. /// [RubyMethod("modulo")] - public static object Modulo(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Modulo(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "modulo", context, self, other); } @@ -385,7 +372,7 @@ /// Self is first coerced by other and then the * operator is invoked on the coerced self. /// [RubyMethod("*")] - public static object Multiply(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Multiply(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "*", context, self, other); } @@ -427,7 +414,7 @@ /// Self is first coerced by other and then the ** operator is invoked on the coerced self. /// [RubyMethod("**")] - public static object Power(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Power(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "**", context, self, other); } @@ -471,7 +458,7 @@ /// Self is first coerced by other and then the + operator is invoked on the coerced self. /// [RubyMethod("+")] - public static object Add(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Add(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "+", context, self, other); } @@ -515,7 +502,7 @@ /// Self is first coerced by other and then the - operator is invoked on the coerced self. /// [RubyMethod("-")] - public static object Subtract(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Subtract(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "-", context, self, other); } @@ -558,7 +545,7 @@ /// Self is first coerced by other and then the / operator is invoked on the coerced self. /// [RubyMethod("/")] - public static object DivideOp(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object DivideOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "/", context, self, other); } @@ -573,7 +560,7 @@ /// Self is first coerced by other and then the div method is invoked on the coerced self. /// [RubyMethod("div")] - public static object Div(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Div(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "div", context, self, other); } @@ -669,7 +656,7 @@ /// Self is first coerced by other and then the divmod method is invoked on the coerced self. /// [RubyMethod("divmod")] - public static object DivMod(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object DivMod(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "divmod", context, self, other); } @@ -694,7 +681,7 @@ /// Self is first coerced by other and then the quo method is invoked on the coerced self. /// [RubyMethod("quo")] - public static object Quotient(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Quotient(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "quo", context, self, other); } @@ -735,7 +722,7 @@ /// Self is first coerced by other and then the < operator is invoked on the coerced self. /// [RubyMethod("<")] - public static bool LessThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool LessThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, object self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<", context, self, other); } @@ -761,7 +748,7 @@ /// Self is first coerced by other and then the <= operator is invoked on the coerced self. /// [RubyMethod("<=")] - public static bool LessThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool LessThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<=", context, self, other); } @@ -797,7 +784,7 @@ /// Self is first coerced by other and then the <=> operator is invoked on the coerced self. /// [RubyMethod("<=>")] - public static object Compare(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object Compare(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndCompare(coercionStorage, comparisonStorage, context, self, other); } @@ -805,6 +792,7 @@ #endregion #region == + /// /// Test whether self is numerically equivalent to other. (Does not require type equivalence). /// @@ -816,6 +804,7 @@ public static bool Equal(int self, int other) { return self == other; } + /// /// Test whether self is numerically equivalent to other. (Does not require type equivalence). /// @@ -825,12 +814,13 @@ /// i.e. call other == self /// [RubyMethod("==")] - public static bool Equal(RubyContext/*!*/ context, int self, object other) { + public static bool Equal(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, int self, object other) { // If self == other doesn't work then try other == self - return Protocols.IsEqual(context, other, self); + return Protocols.IsEqual(equals, context, other, self); } + #endregion - + #region > /// @@ -850,7 +840,7 @@ /// Self is first coerced by other and then the > operator is invoked on the coerced self. /// [RubyMethod(">")] - public static bool GreaterThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool GreaterThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">", context, self, other); } @@ -876,7 +866,7 @@ /// Self is first coerced by other and then the >= operator is invoked on the coerced self. /// [RubyMethod(">=")] - public static bool GreaterThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool GreaterThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, int self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">=", context, self, other); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FloatOps.cs;C659171 File: FloatOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FloatOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FloatOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using Microsoft.Scripting.Runtime; using Microsoft.Scripting.Math; @@ -108,8 +105,9 @@ /// /// Float [RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)] - public static double InducedFrom(RubyClass/*!*/ self, int value) { - return RubySites.ToF(self.Context, value); + public static object InducedFrom(UnaryOpStorage/*!*/ tofStorage, RubyClass/*!*/ self, int value) { + var site = tofStorage.GetCallSite("to_f"); + return site.Target(site, self.Context, ScriptingRuntimeHelpers.Int32ToObject(value)); } /// @@ -117,8 +115,9 @@ /// /// Float [RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)] - public static double InducedFrom(RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) { - return RubySites.ToF(self.Context, value); + public static object InducedFrom(UnaryOpStorage/*!*/ tofStorage, RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) { + var site = tofStorage.GetCallSite("to_f"); + return site.Target(site, self.Context, value); } /// @@ -168,7 +167,7 @@ /// /// [RubyMethod("*")] - public static object Multiply(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Multiply(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "*", context, self, other); } @@ -209,7 +208,7 @@ /// /// [RubyMethod("+")] - public static object Add(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Add(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "+", context, self, other); } @@ -250,7 +249,7 @@ /// /// [RubyMethod("-")] - public static object Subtract(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Subtract(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "-", context, self, other); } @@ -291,7 +290,7 @@ /// /// [RubyMethod("/")] - public static object Divide(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Divide(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "/", context, self, other); } @@ -332,7 +331,7 @@ /// /// [RubyMethod("%")] - public static object ModuloOp(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object ModuloOp(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "%", context, self, other); } @@ -342,7 +341,7 @@ /// /// [RubyMethod("modulo")] - public static object Modulo(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Modulo(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "modulo", context, self, other); } @@ -379,7 +378,7 @@ /// Raises self the other power, where other is not Fixnum, Bignum or Float. /// [RubyMethod("**")] - public static object Power(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object Power(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "**", context, self, other); } @@ -458,7 +457,7 @@ /// The quotient is rounded toward -infinity /// [RubyMethod("divmod")] - public static object DivMod(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object DivMod(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "divmod", context, self, other); } @@ -518,6 +517,7 @@ #endregion #region to_i, to_int, truncate + /// /// Returns self truncated to an Integer. /// @@ -529,6 +529,7 @@ return Ceil(self); } } + #endregion #region coerce @@ -592,7 +593,7 @@ /// [RubyMethod("to_s")] public static MutableString ToS(RubyContext/*!*/ context, double self) { - StringFormatter sf = new StringFormatter(context, "%.15g", new object[] { self }); + StringFormatter sf = new StringFormatter(null, null, context, "%.15g", new object[] { self }); sf.TrailingZeroAfterWholeFloat = true; return sf.Format(); } @@ -635,9 +636,9 @@ /// Dynamically invokes other == self (i.e. swaps operands around). /// [RubyMethod("==")] - public static bool Equal(RubyContext/*!*/ context, double self, object other) { + public static bool Equal(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, double self, object other) { // Call == on the right operand like Float#== does - return Protocols.IsEqual(context, other, self); + return Protocols.IsEqual(equals, context, other, self); } #endregion @@ -715,7 +716,7 @@ /// This is the basis for the tests in Comparable. /// [RubyMethod("<=>")] - public static object Compare(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static object Compare(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndCompare(coercionStorage, comparisonStorage, context, self, other); } @@ -755,7 +756,7 @@ /// Returns true if self is less than other, where other is not Float, Fixnum or Bignum. /// [RubyMethod("<")] - public static bool LessThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool LessThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<", context, self, other); } @@ -795,7 +796,7 @@ /// Returns true if self is less than or equal to other, where other is not Float, Fixnum or Bignum. /// [RubyMethod("<=")] - public static bool LessThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool LessThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, "<=", context, self, other); } @@ -835,7 +836,7 @@ /// Returns true if self is greater than other, where other is not Float, Fixnum or Bignum. /// [RubyMethod(">")] - public static bool GreaterThan(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool GreaterThan(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">", context, self, other); } @@ -875,7 +876,7 @@ /// Returns true if self is greater than or equal to other, where other is not Float, Fixnum or Bignum. /// [RubyMethod(">=")] - public static bool GreaterThanOrEqual(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ comparisonStorage, + public static bool GreaterThanOrEqual(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, double self, object other) { return Protocols.CoerceAndRelate(coercionStorage, comparisonStorage, ">=", context, self, other); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs;C659171 File: HashOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs;MoreSites4 @@ -121,7 +121,7 @@ #region Instance Methods [RubyMethod("[]")] - public static object GetElement(SiteLocalStorage>>/*!*/ storage, + public static object GetElement(CallSiteStorage>/*!*/ storage, RubyContext/*!*/ context, Hash/*!*/ self, object key) { object result; if (!self.TryGetValue(BaseSymbolDictionary.NullToObj(key), out result)) { @@ -137,7 +137,7 @@ } [RubyMethod("default")] - public static object GetDefaultValue(SiteLocalStorage>>/*!*/ storage, + public static object GetDefaultValue(CallSiteStorage>/*!*/ storage, RubyContext/*!*/ context, Hash/*!*/ self, object key) { if (self.DefaultProc != null) { var site = storage.GetCallSite("call", 2); @@ -181,23 +181,25 @@ return str; } } - + [RubyMethod("replace")] - public static Hash/*!*/ Replace(RubyContext/*!*/ context, Hash/*!*/ self, object other) { - if (Object.ReferenceEquals(self, other)) + public static Hash/*!*/ Replace(RubyContext/*!*/ context, Hash/*!*/ self, [DefaultProtocol, NotNull]IDictionary/*!*/ other) { + if (Object.ReferenceEquals(self, other)) { return self; + } RubyUtils.RequiresNotFrozen(context, self); - // If we are copying from another Hash, copy the default value/block, otherwise set to nil Hash otherHash = other as Hash; - self.DefaultValue = (otherHash != null) ? otherHash.DefaultValue : null; - self.DefaultProc = (otherHash != null) ? otherHash.DefaultProc : null; - return IDictionaryOps.ReplaceData(self, IDictionaryOps.ConvertToHash(context, other)); + if (otherHash != null) { + self.DefaultValue = otherHash.DefaultValue; + self.DefaultProc = otherHash.DefaultProc; + } + return IDictionaryOps.ReplaceData(self, other); } [RubyMethod("shift")] - public static object Shift(SiteLocalStorage>>/*!*/ storage, + public static object Shift(CallSiteStorage>/*!*/ storage, RubyContext/*!*/ context, Hash/*!*/ self) { RubyUtils.RequiresNotFrozen(context, self); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Integer.cs;C667395 File: Integer.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Integer.cs;C667395 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Integer.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using IronRuby.Runtime; using Microsoft.Scripting.Math; @@ -55,8 +52,9 @@ /// Convert obj to an Integer, where obj is Float /// [RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)] - public static object InducedFrom(RubyClass/*!*/ self, double obj) { - return RubySites.ToI(self.Context, obj); + public static object InducedFrom(UnaryOpStorage/*!*/ toiStorage, RubyClass/*!*/ self, double obj) { + var site = toiStorage.GetCallSite("to_i"); + return site.Target(site, self.Context, obj); } /// @@ -91,12 +89,11 @@ #region chr [RubyMethod("chr")] - public static MutableString/*!*/ ToChr(RubyContext/*!*/ context, object self) { - int intSelf = Protocols.CastToFixnum(context, self); - if (intSelf < 0 || intSelf > 255) { - throw RubyExceptions.CreateRangeError(String.Format("{0} out of char range", intSelf)); + public static MutableString/*!*/ ToChr(RubyContext/*!*/ context, [DefaultProtocol]int self) { + if (self < 0 || self > 255) { + throw RubyExceptions.CreateRangeError(String.Format("{0} out of char range", self)); } - return MutableString.CreateBinary(new byte[] { (byte)intSelf }); + return MutableString.CreateBinary(new byte[] { (byte)self }); } #endregion @@ -144,13 +141,13 @@ /// [RubyMethod("downto")] public static object DownTo( - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ subtractStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ subtractStorage, RubyContext/*!*/ context, BlockParam block, object/*!*/ self, object other) { object i = self; object compare = null; - var lessThan = lessThanStorage.GetCallSite("<", 1); + var lessThan = lessThanStorage.GetCallSite("<"); while (RubyOps.IsFalse(compare)) { // Rather than test i >= other we test !(i < other) compare = lessThan.Target(lessThan, context, i, other); @@ -171,7 +168,7 @@ return result; } - var subtract = subtractStorage.GetCallSite("-", 1); + var subtract = subtractStorage.GetCallSite("-"); i = subtract.Target(subtract, context, i, 1); } } @@ -216,8 +213,8 @@ /// Dynamically invokes "+" operator to get next value. [RubyMethod("succ")] [RubyMethod("next")] - public static object Next(SiteLocalStorage/*!*/ addStorage, RubyContext/*!*/ context, object/*!*/ self) { - var site = addStorage.GetCallSite("+", 1); + public static object Next(BinaryOpStorage/*!*/ addStorage, RubyContext/*!*/ context, object/*!*/ self) { + var site = addStorage.GetCallSite("+"); return site.Target(site, context, self, 1); } @@ -264,12 +261,12 @@ /// [RubyMethodAttribute("times")] public static object Times( - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ addStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ addStorage, RubyContext/*!*/ context, BlockParam block, object/*!*/ self) { object i = 0; - var lessThan = lessThanStorage.GetCallSite("<", 1); + var lessThan = lessThanStorage.GetCallSite("<"); while (RubyOps.IsTrue(lessThan.Target(lessThan, context, i, self))) { if (block == null) { throw RubyExceptions.NoBlockGiven(); @@ -280,7 +277,7 @@ return result; } - var add = addStorage.GetCallSite("+", 1); + var add = addStorage.GetCallSite("+"); i = add.Target(add, context, i, 1); } return self; @@ -330,13 +327,13 @@ /// [RubyMethod("upto")] public static object UpTo( - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ addStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ addStorage, RubyContext/*!*/ context, BlockParam block, object/*!*/ self, object other) { object i = self; object compare = null; - var greaterThan = greaterThanStorage.GetCallSite(">", 1); + var greaterThan = greaterThanStorage.GetCallSite(">"); while (RubyOps.IsFalse(compare)) { // Rather than test i <= other we test !(i > other) compare = greaterThan.Target(greaterThan, context, i, other); @@ -357,7 +354,7 @@ return result; } - var add = addStorage.GetCallSite("+", 1); + var add = addStorage.GetCallSite("+"); i = add.Target(add, context, i, 1); } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;C659171 File: IoOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections.Generic; using System.IO; @@ -582,10 +579,10 @@ } [RubyMethod("print")] - public static void Print(RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { + public static void Print(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { MutableString delimiter = context.OutputSeparator; for (int i = 0; i < args.Length; i++) { - MutableString str = ToPrintedString(context, args[i]); + MutableString str = ToPrintedString(tosStorage, context, args[i]); if (delimiter != null) { str.Append(delimiter); } @@ -615,15 +612,15 @@ private static readonly MutableString NewLine = MutableString.CreateMutable("\n").Freeze(); - public static MutableString/*!*/ ToPrintedString(RubyContext/*!*/ context, object obj) { + public static MutableString/*!*/ ToPrintedString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object obj) { IDictionary hash; List list; MutableString str; if ((list = obj as List) != null) { - return IListOps.Join(context, list, NewLine); + return IListOps.Join(tosStorage, context, list, NewLine); } else if ((hash = obj as IDictionary) != null) { - return IDictionaryOps.ToString(context, hash); + return IDictionaryOps.ToString(tosStorage, context, hash); } else if (obj == null) { return MutableString.Create("nil"); } else if (obj is bool) { @@ -637,7 +634,7 @@ } else if ((str = obj as MutableString) != null) { return str; } else { - return RubySites.ToS(context, obj); + return RubyUtils.ObjectToMutableString(tosStorage, context, obj); } } @@ -656,22 +653,23 @@ } [RubyMethod("puts")] - public static void Puts(RubyContext/*!*/ context, object self, [NotNull]object/*!*/ val) { - Puts(context, self, ToPrintedString(context, val)); + public static void Puts(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]object/*!*/ val) { + Puts(context, self, ToPrintedString(tosStorage, context, val)); } [RubyMethod("puts")] - public static void Puts(RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ vals) { - for (int i = 0; i < vals.Length; ++i) { - Puts(context, self, vals[i]); + public static void Puts(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ vals) { + for (int i = 0; i < vals.Length; i++) { + Puts(tosStorage, context, self, vals[i]); } } [RubyMethod("printf")] - public static void PrintFormatted(SiteLocalStorage>>/*!*/ writeSiteStorage, + public static void PrintFormatted(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + BinaryOpStorage/*!*/ writeStorage, RubyContext/*!*/ context, RubyIO/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ format, [NotNull]params object[]/*!*/ args) { - KernelOps.PrintFormatted(writeSiteStorage, context, null, self, format, args); + KernelOps.PrintFormatted(fixnumCast, tosConversion, writeStorage, context, null, self, format, args); } #endregion @@ -689,8 +687,8 @@ } [RubyMethod("write")] - public static int Write(RubyContext/*!*/ context, RubyIO/*!*/ self, object obj) { - return Write(self, Protocols.ConvertToString(context, obj)); + public static int Write(ConversionStorage/*!*/ tosStorage, RubyContext/*!*/ context, RubyIO/*!*/ self, object obj) { + return Write(self, Protocols.ConvertToString(tosStorage, context, obj)); } //write_nonblock @@ -963,7 +961,7 @@ #endregion - internal static IOWrapper/*!*/ CreateIOWrapper(SiteLocalStorage/*!*/ respondToStorage, + internal static IOWrapper/*!*/ CreateIOWrapper(RespondToStorage/*!*/ respondToStorage, RubyContext/*!*/ context, object io, FileAccess access) { bool canRead, canWrite, canSeek; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;C669880 File: KernelOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;MoreSites4 @@ -29,9 +29,6 @@ using Microsoft.Scripting.Utils; using Microsoft.Scripting.Generation; -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - namespace IronRuby.Builtins { [RubyModule("Kernel", Extends = typeof(Kernel))] @@ -103,13 +100,16 @@ public static object/*!*/ ToInteger(RubyContext/*!*/ context, object self, object obj) { // TODO: MRI converts strings with base prefix ("0x1", "0d1", "0o1") and octals "000" as well // should the protocol do that or is is a specificity of this method? - return Protocols.ConvertToInteger(context, obj); + int fixnum; + BigInteger bignum; + Protocols.ConvertToInteger(context, obj, out fixnum, out bignum); + return (object)bignum ?? ScriptingRuntimeHelpers.Int32ToObject(fixnum); } [RubyMethod("String", RubyMethodAttributes.PrivateInstance)] [RubyMethod("String", RubyMethodAttributes.PublicSingleton)] - public static object/*!*/ ToString(RubyContext/*!*/ context, object self, object obj) { - return Protocols.ConvertToString(context, obj); + public static object/*!*/ ToString(ConversionStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, object obj) { + return Protocols.ConvertToString(tosStorage, context, obj); } #region `, exec, system @@ -515,13 +515,13 @@ [RubyMethod("p", RubyMethodAttributes.PrivateInstance)] [RubyMethod("p", RubyMethodAttributes.PublicSingleton)] - public static void PrintInspect(RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { + public static void PrintInspect(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { for (int i = 0; i < args.Length; i++) { args[i] = RubySites.Inspect(context, args[i]); } // no dynamic dispatch to "puts": - RubyIOOps.Puts(context, context.StandardOutput, args); + RubyIOOps.Puts(tosStorage, context, context.StandardOutput, args); } [RubyMethod("print", RubyMethodAttributes.PrivateInstance)] @@ -540,31 +540,33 @@ [RubyMethod("print", RubyMethodAttributes.PrivateInstance)] [RubyMethod("print", RubyMethodAttributes.PublicSingleton)] - public static void Print(RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { + public static void Print(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { // no dynamic dispatch to "print": - RubyIOOps.Print(context, context.StandardOutput, args); + RubyIOOps.Print(tosStorage, context, context.StandardOutput, args); } // this overload is called only if the first parameter is string: [RubyMethod("printf", RubyMethodAttributes.PrivateInstance)] [RubyMethod("printf", RubyMethodAttributes.PublicSingleton)] - public static void PrintFormatted(SiteLocalStorage>>/*!*/ storage, + public static void PrintFormatted(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + BinaryOpStorage/*!*/ writeStorage, RubyContext/*!*/ context, object self, [NotNull]MutableString/*!*/ format, [NotNull]params object[]/*!*/ args) { - PrintFormatted(storage, context, self, context.StandardOutput, format, args); + PrintFormatted(fixnumCast, tosConversion, writeStorage, context, self, context.StandardOutput, format, args); } [RubyMethod("printf", RubyMethodAttributes.PrivateInstance)] [RubyMethod("printf", RubyMethodAttributes.PublicSingleton)] - public static void PrintFormatted(SiteLocalStorage>>/*!*/ storage, + public static void PrintFormatted(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + BinaryOpStorage/*!*/ writeStorage, RubyContext/*!*/ context, object self, object io, [NotNull]object/*!*/ format, [NotNull]params object[]/*!*/ args) { Debug.Assert(!(io is MutableString)); // TODO: BindAsObject attribute on format? // format cannot be strongly typed to MutableString due to ambiguity between signatures (MS, object) vs (object, MS) - var site = storage.GetCallSite("write", 1); - site.Target(site, context, io, Sprintf(context, self, Protocols.CastToString(context, format), args)); + var site = writeStorage.GetCallSite("write"); + site.Target(site, context, io, Sprintf(fixnumCast, tosConversion, context, self, Protocols.CastToString(context, format), args)); } [RubyMethod("putc", RubyMethodAttributes.PrivateInstance)] @@ -590,9 +592,9 @@ [RubyMethod("puts", RubyMethodAttributes.PrivateInstance)] [RubyMethod("puts", RubyMethodAttributes.PublicSingleton)] - public static void PutString(RubyContext/*!*/ context, object self, object arg) { + public static void PutString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, object arg) { // call directly, no dynamic dispatch to "self": - RubyIOOps.Puts(context, context.StandardOutput, arg); + RubyIOOps.Puts(tosStorage, context, context.StandardOutput, arg); } [RubyMethod("puts", RubyMethodAttributes.PrivateInstance)] @@ -604,20 +606,20 @@ [RubyMethod("puts", RubyMethodAttributes.PrivateInstance)] [RubyMethod("puts", RubyMethodAttributes.PublicSingleton)] - public static void PutString(RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { + public static void PutString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object self, [NotNull]params object[]/*!*/ args) { // call directly, no dynamic dispatch to "self": - RubyIOOps.Puts(context, context.StandardOutput, args); + RubyIOOps.Puts(tosStorage, context, context.StandardOutput, args); } [RubyMethod("warn", RubyMethodAttributes.PrivateInstance)] [RubyMethod("warn", RubyMethodAttributes.PublicSingleton)] - public static void ReportWarning(SiteLocalStorage>>/*!*/ storage, + public static void ReportWarning(UnaryOpStorage/*!*/ tosStorage, BinaryOpStorage/*!*/ writeStorage, RubyContext/*!*/ context, object self, object message) { if (context.Verbose != null) { // MRI: unlike Kernel#puts this outputs \n even if the message ends with \n: - var site = storage.GetCallSite("write", 1); - site.Target(site, context, context.StandardErrorOutput, RubyIOOps.ToPrintedString(context, message)); + var site = writeStorage.GetCallSite("write", 1); + site.Target(site, context, context.StandardErrorOutput, RubyIOOps.ToPrintedString(tosStorage, context, message)); RubyIOOps.PutsEmptyLine(context, context.StandardErrorOutput); } } @@ -625,24 +627,23 @@ // TODO: not supported in Ruby 1.9 [RubyMethod("getc", RubyMethodAttributes.PrivateInstance)] [RubyMethod("getc", RubyMethodAttributes.PublicSingleton)] - public static object ReadInputCharacter(SiteLocalStorage>>/*!*/ storage, - RubyContext/*!*/ context, object self) { + public static object ReadInputCharacter(UnaryOpStorage/*!*/ getcStorage, RubyContext/*!*/ context, object self) { context.ReportWarning("getc is obsolete; use STDIN.getc instead"); - var site = storage.GetCallSite("getc", 0); + var site = getcStorage.GetCallSite("getc", 0); return site.Target(site, context, context.StandardInput); } [RubyMethod("gets", RubyMethodAttributes.PrivateInstance)] [RubyMethod("gets", RubyMethodAttributes.PublicSingleton)] - public static object ReadInputLine(SiteLocalStorage>>/*!*/ storage, + public static object ReadInputLine(CallSiteStorage>/*!*/ storage, RubyContext/*!*/ context, object self) { return ReadInputLine(storage, context, self, context.InputSeparator); } [RubyMethod("gets", RubyMethodAttributes.PrivateInstance)] [RubyMethod("gets", RubyMethodAttributes.PublicSingleton)] - public static object ReadInputLine(SiteLocalStorage>>/*!*/ storage, + public static object ReadInputLine(CallSiteStorage>/*!*/ storage, RubyContext/*!*/ context, object self, [NotNull]MutableString/*!*/ separator) { var site = storage.GetCallSite("gets", 1); return site.Target(site, context, context.StandardInput, separator); @@ -681,19 +682,16 @@ [RubyMethod("fail", RubyMethodAttributes.PrivateInstance)] [RubyMethod("fail", RubyMethodAttributes.PublicSingleton)] [RubyStackTraceHidden] - public static void RaiseException( - SiteLocalStorage/*!*/ respondToStorage, - SiteLocalStorage>>/*!*/ storage0, - SiteLocalStorage>>/*!*/ storage1, + public static void RaiseException(RespondToStorage/*!*/ respondToStorage, UnaryOpStorage/*!*/ storage0, BinaryOpStorage/*!*/ storage1, RubyContext/*!*/ context, object self, object/*!*/ obj, [Optional]object arg, [Optional]RubyArray backtrace) { if (Protocols.RespondTo(respondToStorage, context, obj, "exception")) { Exception e; if (arg != Missing.Value) { - var site = storage1.GetCallSite("exception", 1); + var site = storage1.GetCallSite("exception"); e = site.Target(site, context, obj, arg) as Exception; } else { - var site = storage0.GetCallSite("exception", 0); + var site = storage0.GetCallSite("exception"); e = site.Target(site, context, obj) as Exception; } @@ -746,11 +744,12 @@ [RubyMethod("rand", RubyMethodAttributes.PrivateInstance)] [RubyMethod("rand", RubyMethodAttributes.PublicSingleton)] - public static object Rand(RubyContext/*!*/ context, object self, object limit) { + public static object Rand(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, object self, object limit) { if (limit == null) { return Rand(context, self); } - return Rand(context, self, Protocols.CastToFixnum(context, limit)); + // TODO: to_int can return bignum here + return Rand(context, self, Protocols.CastToFixnum(conversionStorage, context, limit)); } //readline @@ -820,10 +819,10 @@ [RubyMethod("format", RubyMethodAttributes.PublicSingleton)] [RubyMethod("sprintf", RubyMethodAttributes.PrivateInstance)] [RubyMethod("sprintf", RubyMethodAttributes.PublicSingleton)] - public static MutableString/*!*/ Sprintf(RubyContext/*!*/ context, object self, - [DefaultProtocol, NotNull]MutableString/*!*/ format, [NotNull]params object[] args) { + public static MutableString/*!*/ Sprintf(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ format, [NotNull]params object[] args) { - return new StringFormatter(context, format.ConvertToString(), args).Format(); + return new StringFormatter(fixnumCast, tosConversion, context, format.ConvertToString(), args).Format(); } //srand @@ -926,8 +925,8 @@ // calls == by default [RubyMethod("===")] - public static bool HashEquals(RubyContext/*!*/ context, object self, object other) { - return Protocols.IsEqual(context, self, other); + public static bool HashEquals(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, object self, object other) { + return Protocols.IsEqual(equals, context, self, other); } [RubyMethod("hash")] @@ -983,18 +982,26 @@ #region clone, dup [RubyMethod("clone")] - public static object/*!*/ Clone(RubyContext/*!*/ context, object self) { + public static object/*!*/ Clone( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, object self) { + object result; - if (!RubyUtils.TryDuplicateObject(context, self, true, out result)) { + if (!RubyUtils.TryDuplicateObject(initializeCopyStorage, allocateStorage, context, self, true, out result)) { throw RubyExceptions.CreateTypeError(String.Format("can't clone {0}", RubyUtils.GetClassName(context, self))); } return context.TaintObjectBy(result, self); } [RubyMethod("dup")] - public static object/*!*/ Duplicate(RubyContext/*!*/ context, object self) { + public static object/*!*/ Duplicate( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, object self) { + object result; - if (!RubyUtils.TryDuplicateObject(context, self, false, out result)) { + if (!RubyUtils.TryDuplicateObject(initializeCopyStorage, allocateStorage, context, self, false, out result)) { throw RubyExceptions.CreateTypeError(String.Format("can't dup {0}", RubyUtils.GetClassName(context, self))); } return context.TaintObjectBy(result, self); @@ -1009,8 +1016,8 @@ [RubyMethod("extend")] public static object Extend( - SiteLocalStorage>>/*!*/ extendObjectStorage, - SiteLocalStorage>>/*!*/ extendedStorage, + CallSiteStorage>/*!*/ extendObjectStorage, + CallSiteStorage>/*!*/ extendedStorage, RubyContext/*!*/ context, object self, [NotNull]RubyModule/*!*/ module, [NotNull]params RubyModule/*!*/[]/*!*/ modules) { @@ -1366,11 +1373,14 @@ /// Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003" /// [RubyMethod("inspect")] - public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, object self) { - if (context.GetClassOf(self) == context.ObjectClass) { - return RubyUtils.ObjectToMutableString(context, self); + public static MutableString/*!*/ Inspect(UnaryOpStorage/*!*/ inspectStorage, ConversionStorage/*!*/ tosStorage, + RubyContext/*!*/ context, object self) { + + if (context.HasInstanceVariables(self)) { + return RubyUtils.InspectObject(inspectStorage, tosStorage, context, self); } else { - return RubySites.ToS(context, self); + var site = tosStorage.GetSite(ConvertToSAction.Instance); + return site.Target(site, context, self); } } @@ -1384,7 +1394,7 @@ [RubyMethod("to_s")] public static MutableString/*!*/ ToS(RubyContext/*!*/ context, object self) { - return RubyUtils.ObjectToMutableString(context, self).TaintBy(self, context); + return RubyUtils.ObjectToMutableString(context, self); } #endregion =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;C669880 File: Marshal.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Marshal.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections.Generic; using System.IO; @@ -188,7 +185,7 @@ } else if (Double.IsNaN(value)) { WriteStringValue(_nanString); } else { - StringFormatter sf = new StringFormatter(_context, "%.15g", new object[] { value }); + StringFormatter sf = new StringFormatter(null, null, _context, "%.15g", new object[] { value }); sf.TrailingZeroAfterWholeFloat = false; WriteStringValue(sf.Format()); } @@ -942,7 +939,7 @@ // TODO: Use DefaultValue attribute when it works with the binder [RubyMethod("dump", RubyMethodAttributes.PublicSingleton)] - public static object Dump(SiteLocalStorage/*!*/ sites, SiteLocalStorage/*!*/ respondToStorage, + public static object Dump(SiteLocalStorage/*!*/ sites, RespondToStorage/*!*/ respondToStorage, RubyModule/*!*/ self, object obj, object io, [Optional]int? limit) { Stream stream = null; if (io != null) { @@ -976,7 +973,7 @@ [RubyMethod("load", RubyMethodAttributes.PublicSingleton)] [RubyMethod("restore", RubyMethodAttributes.PublicSingleton)] - public static object Load(SiteLocalStorage/*!*/ sites, SiteLocalStorage/*!*/ respondToStorage, + public static object Load(SiteLocalStorage/*!*/ sites, RespondToStorage/*!*/ respondToStorage, RubyScope/*!*/ scope, RubyModule/*!*/ self, object source, [Optional]Proc proc) { Stream stream = null; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MatchDataOps.cs;C633889 File: MatchDataOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MatchDataOps.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MatchDataOps.cs;MoreSites4 @@ -56,9 +56,9 @@ } [RubyMethod("[]")] - public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]Range/*!*/ range) { + public static RubyArray GetGroup(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]Range/*!*/ range) { int begin, count; - if (!IListOps.NormalizeRange(context, self.Groups.Count, range, out begin, out count)) { + if (!IListOps.NormalizeRange(fixnumCast, context, self.Groups.Count, range, out begin, out count)) { return null; } return GetGroup(context, self, begin, count); @@ -154,10 +154,12 @@ } [RubyMethod("values_at")] - public static RubyArray/*!*/ ValuesAt(RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]params object[]/*!*/ indices) { + public static RubyArray/*!*/ ValuesAt(ConversionStorage/*!*/ conversionStorage, + RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]params object[]/*!*/ indices) { + RubyArray result = new RubyArray(); for (int i = 0; i < indices.Length; i++) { - result.Add(GetGroup(context, self, Protocols.CastToFixnum(context, indices[i]))); + result.Add(GetGroup(context, self, Protocols.CastToFixnum(conversionStorage, context, indices[i]))); } return result; } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ModuleOps.cs;C672727 File: ModuleOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ModuleOps.cs;C672727 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ModuleOps.cs;MoreSites4 @@ -107,8 +107,8 @@ [RubyMethod("include", RubyMethodAttributes.PrivateInstance)] public static RubyModule/*!*/ Include( - SiteLocalStorage>>/*!*/ appendFeaturesStorage, - SiteLocalStorage>>/*!*/ includedStorage, + CallSiteStorage>/*!*/ appendFeaturesStorage, + CallSiteStorage>/*!*/ includedStorage, RubyModule/*!*/ self, [NotNull]params RubyModule[]/*!*/ modules) { RubyUtils.RequireMixins(self, modules); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;C667392 File: MutableStringOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;MoreSites4 @@ -13,15 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - -using UnaryOpSite = System.Runtime.CompilerServices.CallSite>; - -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Diagnostics; @@ -339,12 +330,11 @@ #region % [RubyMethod("%")] - public static MutableString/*!*/ Format(RubyContext/*!*/ context, MutableString/*!*/ self, object arg) { - IList args = arg as IList; - if (args == null) { - args = new object[] { arg }; - } - StringFormatter formatter = new StringFormatter(context, self.ConvertToString(), args); + public static MutableString/*!*/ Format(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + RubyContext/*!*/ context, MutableString/*!*/ self, object arg) { + + IList args = arg as IList ?? new object[] { arg }; + StringFormatter formatter = new StringFormatter(fixnumCast, tosConversion, context, self.ConvertToString(), args); return formatter.Format().TaintBy(self); } @@ -402,16 +392,14 @@ } [RubyMethod("<=>")] - public static object Compare( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ respondToStorage, + public static object Compare(BinaryOpStorage/*!*/ comparisonStorage, RespondToStorage/*!*/ respondToStorage, RubyContext/*!*/ context, MutableString/*!*/ self, object other) { // We test to see if other responds to to_str AND <=> // Ruby never attempts to convert other to a string via to_str and call Compare ... which is strange -- feels like a BUG in Ruby if (Protocols.RespondTo(respondToStorage, context, other, "to_str") && Protocols.RespondTo(respondToStorage, context, other, "<=>")) { - var site = comparisonStorage.GetCallSite("<=>", 1); + var site = comparisonStorage.GetCallSite("<=>"); object result = Integer.TryUnaryMinus(site.Target(site, context, other, self)); if (result == null) { throw RubyExceptions.CreateTypeError(String.Format("{0} can't be coerced into Fixnum", @@ -432,14 +420,12 @@ [RubyMethod("==")] [RubyMethod("===")] - public static bool Equals( - SiteLocalStorage/*!*/ respondToStorage, - SiteLocalStorage/*!*/ equalsStorage, + public static bool Equals(RespondToStorage/*!*/ respondToStorage, BinaryOpStorage/*!*/ equalsStorage, RubyContext/*!*/ context, MutableString/*!*/ self, object other) { - BinaryOpSite equals; + CallSite> equals; return Protocols.RespondTo(respondToStorage, context, other, "to_str") - && Protocols.IsTrue((equals = equalsStorage.GetCallSite("==", 1)).Target(equals, context, other, self)); + && Protocols.IsTrue((equals = equalsStorage.GetCallSite("==")).Target(equals, context, other, self)); } #endregion @@ -504,18 +490,18 @@ } [RubyMethod("slice!")] - public static MutableString RemoveSubstringInPlace(RubyContext/*!*/ context, MutableString/*!*/ self, [NotNull]Range/*!*/ range) { - bool excludeEnd; - int begin, end; - Protocols.ConvertToIntegerRange(context, range, out begin, out end, out excludeEnd); - + public static MutableString RemoveSubstringInPlace(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, + MutableString/*!*/ self, [NotNull]Range/*!*/ range) { + int begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); + if (!InInclusiveRangeNormalized(self, ref begin)) { return null; } end = NormalizeIndex(self, end); - int count = excludeEnd ? end - begin : end - begin + 1; + int count = range.ExcludeEnd ? end - begin : end - begin + 1; return count < 0 ? self.CreateInstance() : RemoveSubstringInPlace(self, begin, count); } @@ -594,10 +580,10 @@ [RubyMethod("[]")] [RubyMethod("slice")] - public static MutableString GetSubstring(RubyContext/*!*/ context, MutableString/*!*/ self, [NotNull]Range/*!*/ range) { - bool excludeEnd; - int begin, end; - Protocols.ConvertToIntegerRange(context, range, out begin, out end, out excludeEnd); + public static MutableString GetSubstring(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, MutableString/*!*/ self, + [NotNull]Range/*!*/ range) { + int begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); begin = NormalizeIndex(self, begin); if (begin < 0 || begin > self.Length) { @@ -606,7 +592,7 @@ end = NormalizeIndex(self, end); - int count = excludeEnd ? end - begin : end - begin + 1; + int count = range.ExcludeEnd ? end - begin : end - begin + 1; return (count < 0) ? self.CreateInstance().TaintBy(self) : GetSubstring(self, begin, count); } @@ -725,13 +711,12 @@ } [RubyMethod("[]=")] - public static MutableString/*!*/ ReplaceSubstring(RubyContext/*!*/ context, MutableString/*!*/ self, + public static MutableString/*!*/ ReplaceSubstring(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, MutableString/*!*/ self, [NotNull]Range/*!*/ range, [DefaultProtocol, NotNull]MutableString/*!*/ value) { - bool excludeEnd; - int begin, end; - Protocols.ConvertToIntegerRange(context, range, out begin, out end, out excludeEnd); - + int begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); + begin = begin < 0 ? begin + self.Length : begin; if (begin < 0 || begin > self.Length) { @@ -740,7 +725,7 @@ end = end < 0 ? end + self.Length : end; - int count = excludeEnd ? end - begin : end - begin + 1; + int count = range.ExcludeEnd ? end - begin : end - begin + 1; return ReplaceSubstring(self, begin, count, value); } @@ -1245,7 +1230,8 @@ // returns true if block jumped // "result" will be null if there is no successful match - private static bool BlockReplaceFirst(RubyScope/*!*/ scope, MutableString/*!*/ input, BlockParam/*!*/ block, + private static bool BlockReplaceFirst(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, MutableString/*!*/ input, BlockParam/*!*/ block, RubyRegex/*!*/ pattern, out object blockResult, out MutableString result) { var matchScope = scope.GetInnerMostClosureScope(); @@ -1265,10 +1251,10 @@ return true; } - // resets the $~ scope variable to the last match (skipd if block jumped): + // resets the $~ scope variable to the last match (skipped if block jumped): matchScope.CurrentMatch = match; - MutableString replacement = Protocols.ConvertToString(scope.RubyContext, blockResult); + MutableString replacement = Protocols.ConvertToString(tosConversion, scope.RubyContext, blockResult); result.TaintBy(replacement); // Note - we don't interpolate special sequences like \1 in block return value @@ -1280,7 +1266,8 @@ // returns true if block jumped // "result" will be null if there is no successful match - private static bool BlockReplaceAll(RubyScope/*!*/ scope, MutableString/*!*/ input, BlockParam/*!*/ block, + private static bool BlockReplaceAll(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, MutableString/*!*/ input, BlockParam/*!*/ block, RubyRegex/*!*/ regex, out object blockResult, out MutableString result) { var matchScope = scope.GetInnerMostClosureScope(); @@ -1312,7 +1299,7 @@ // resets the $~ scope variable to the last match (skipd if block jumped): matchScope.CurrentMatch = currentMatch; - MutableString replacement = Protocols.ConvertToString(scope.RubyContext, blockResult); + MutableString replacement = Protocols.ConvertToString(tosConversion, scope.RubyContext, blockResult); result.TaintBy(replacement); // prematch: @@ -1453,40 +1440,44 @@ } [RubyMethod("sub")] - public static object BlockReplaceFirst(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceFirst(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [NotNull]RubyRegex/*!*/ pattern) { object blockResult; MutableString result; - return BlockReplaceFirst(scope, self, block, pattern, out blockResult, out result) ? blockResult : (result ?? self.Clone()); + return BlockReplaceFirst(tosConversion, scope, self, block, pattern, out blockResult, out result) ? blockResult : (result ?? self.Clone()); } [RubyMethod("gsub")] - public static object BlockReplaceAll(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceAll(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [NotNull]RubyRegex pattern) { object blockResult; MutableString result; uint version = self.Version; - object r = BlockReplaceAll(scope, self, block, pattern, out blockResult, out result) ? blockResult : (result ?? self.Clone()); + object r = BlockReplaceAll(tosConversion, scope, self, block, pattern, out blockResult, out result) ? blockResult : (result ?? self.Clone()); RequireNoVersionChange(version, self); return r; } [RubyMethod("sub")] - public static object BlockReplaceFirst(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceFirst(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [NotNull]MutableString matchString) { object blockResult; MutableString result; var regex = new RubyRegex(Regex.Escape(matchString.ToString()), RubyRegexOptions.NONE); - return BlockReplaceFirst(scope, self, block, regex, out blockResult, out result) ? blockResult : (result ?? self.Clone()); + return BlockReplaceFirst(tosConversion, scope, self, block, regex, out blockResult, out result) ? blockResult : (result ?? self.Clone()); } [RubyMethod("gsub")] - public static object BlockReplaceAll(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceAll(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [NotNull]MutableString matchString) { object blockResult; @@ -1494,7 +1485,7 @@ var regex = new RubyRegex(Regex.Escape(matchString.ToString()), RubyRegexOptions.NONE); uint version = self.Version; - object r = BlockReplaceAll(scope, self, block, regex, out blockResult, out result) ? blockResult : (result ?? self.Clone()); + object r = BlockReplaceAll(tosConversion, scope, self, block, regex, out blockResult, out result) ? blockResult : (result ?? self.Clone()); RequireNoVersionChange(version, self); return r; } @@ -1518,7 +1509,8 @@ #region sub!, gsub! - private static object BlockReplaceInPlace(RubyScope/*!*/ scope, BlockParam/*!*/ block, MutableString/*!*/ self, + private static object BlockReplaceInPlace(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, BlockParam/*!*/ block, MutableString/*!*/ self, RubyRegex/*!*/ pattern, bool replaceAll) { object blockResult; @@ -1528,8 +1520,8 @@ // prepare replacement in a builder: MutableString builder; if (replaceAll ? - BlockReplaceAll(scope, self, block, pattern, out blockResult, out builder) : - BlockReplaceFirst(scope, self, block, pattern, out blockResult, out builder)) { + BlockReplaceAll(tosConversion, scope, self, block, pattern, out blockResult, out builder) : + BlockReplaceFirst(tosConversion, scope, self, block, pattern, out blockResult, out builder)) { // block jumped: return blockResult; @@ -1568,17 +1560,19 @@ } [RubyMethod("sub!")] - public static object BlockReplaceFirstInPlace(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceFirstInPlace(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [DefaultProtocol, NotNull]RubyRegex/*!*/ pattern) { - return BlockReplaceInPlace(scope, block, self, pattern, false); + return BlockReplaceInPlace(tosConversion, scope, block, self, pattern, false); } [RubyMethod("gsub!")] - public static object BlockReplaceAllInPlace(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, + public static object BlockReplaceAllInPlace(ConversionStorage/*!*/ tosConversion, + RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self, [DefaultProtocol, NotNull]RubyRegex/*!*/ pattern) { - return BlockReplaceInPlace(scope, block, self, pattern, true); + return BlockReplaceInPlace(tosConversion, scope, block, self, pattern, true); } [RubyMethod("sub!")] @@ -1843,21 +1837,21 @@ } [RubyMethod("=~")] - public static object Match(SiteLocalStorage>>/*!*/ storage, + public static object Match(CallSiteStorage>/*!*/ storage, RubyScope/*!*/ scope, MutableString/*!*/ self, object obj) { var site = storage.GetCallSite("=~", 1); return site.Target(site, scope.RubyContext, obj, self); } [RubyMethod("match")] - public static object MatchRegexp(SiteLocalStorage>>/*!*/ storage, + public static object MatchRegexp(CallSiteStorage>/*!*/ storage, RubyScope/*!*/ scope, MutableString/*!*/ self, [NotNull]RubyRegex/*!*/ regex) { var site = storage.GetCallSite("match", new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasScope)); return site.Target(site, scope, regex, self); } [RubyMethod("match")] - public static object MatchObject(SiteLocalStorage>>/*!*/ storage, + public static object MatchObject(CallSiteStorage>/*!*/ storage, RubyScope/*!*/ scope, MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ pattern) { var site = storage.GetCallSite("match", new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasScope)); return site.Target(site, scope, new RubyRegex(pattern, RubyRegexOptions.NONE), self); @@ -2087,23 +2081,23 @@ } [RubyMethod("split")] - public static RubyArray/*!*/ Split(RubyScope/*!*/ scope, MutableString/*!*/ self) { - return Split(scope, self, (MutableString)null, 0); + public static RubyArray/*!*/ Split(ConversionStorage/*!*/ stringCast, RubyScope/*!*/ scope, MutableString/*!*/ self) { + return Split(stringCast, scope, self, (MutableString)null, 0); } [RubyMethod("split")] - public static RubyArray/*!*/ Split(RubyScope/*!*/ scope, MutableString/*!*/ self, + public static RubyArray/*!*/ Split(ConversionStorage/*!*/ stringCast, RubyScope/*!*/ scope, MutableString/*!*/ self, [DefaultProtocol]MutableString separator, [DefaultProtocol, Optional]int limit) { if (separator == null) { object defaultSeparator = scope.RubyContext.StringSeparator; RubyRegex regexSeparator = defaultSeparator as RubyRegex; if (regexSeparator != null) { - return Split(scope, self, regexSeparator, limit); + return Split(stringCast, scope, self, regexSeparator, limit); } if (defaultSeparator != null) { - separator = Protocols.CastToString(scope.RubyContext, defaultSeparator); + separator = Protocols.CastToString(stringCast, scope.RubyContext, defaultSeparator); } } @@ -2125,11 +2119,11 @@ } [RubyMethod("split")] - public static RubyArray/*!*/ Split(RubyScope/*!*/ scope, MutableString/*!*/ self, + public static RubyArray/*!*/ Split(ConversionStorage/*!*/ stringCast, RubyScope/*!*/ scope, MutableString/*!*/ self, [NotNull]RubyRegex/*!*/ regexp, [DefaultProtocol, Optional]int limit) { if (regexp.IsEmpty) { - return Split(scope, self, MutableString.Empty, limit); + return Split(stringCast, scope, self, MutableString.Empty, limit); } if (limit == 0) { @@ -2371,8 +2365,8 @@ str = ParseSign(str, ref isNegative); - Tokenizer tokenizer = new Tokenizer(false, ErrorSink.Null); - tokenizer.Initialize(context.CreateSnippet(str, SourceCodeKind.File)); + Tokenizer tokenizer = new Tokenizer(); + tokenizer.Initialize(new StringReader(str)); Tokens token = tokenizer.GetNextToken(); TokenValue value = tokenizer.TokenValue; @@ -2413,7 +2407,9 @@ [RubyMethod("to_f")] public static double ToDouble(MutableString/*!*/ self) { - return Tokenizer.ParseDouble(self.ConvertToString().ToCharArray()); + double result; + bool complete; + return Tokenizer.TryParseDouble(self.ConvertToString(), out result, out complete) ? result : 0.0; } [RubyMethod("to_s")] @@ -2452,15 +2448,16 @@ [RubyMethod("upto")] public static object UpTo( - SiteLocalStorage/*!*/ respondToStorage, - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ equalsStorage, - SiteLocalStorage/*!*/ succStorage, + ConversionStorage/*!*/ stringCast, + RespondToStorage/*!*/ respondToStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ equalsStorage, + UnaryOpStorage/*!*/ succStorage, RubyContext/*!*/ context, BlockParam block, MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ endString) { - RangeOps.Each(respondToStorage, comparisonStorage, lessThanStorage, greaterThanStorage, equalsStorage, succStorage, context, + RangeOps.Each(stringCast, respondToStorage, comparisonStorage, lessThanStorage, greaterThanStorage, equalsStorage, succStorage, context, block, new Range(self, endString, false) ); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Numeric.cs;C667395 File: Numeric.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Numeric.cs;C667395 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Numeric.cs;MoreSites4 @@ -13,12 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - -using UnaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using Microsoft.Scripting.Runtime; using Microsoft.Scripting.Actions; @@ -64,7 +58,7 @@ /// /// [RubyMethod("-@")] - public static object UnaryMinus(SiteLocalStorage/*!*/ coercionStorage, SiteLocalStorage/*!*/ binaryOpSite, + public static object UnaryMinus(BinaryOpStorage/*!*/ coercionStorage, BinaryOpStorage/*!*/ binaryOpSite, RubyContext/*!*/ context, object self) { return Protocols.CoerceAndApply(coercionStorage, binaryOpSite, "-", context, 0, self); @@ -96,13 +90,13 @@ /// [RubyMethod("abs")] public static object Abs( - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ minusStorage, + BinaryOpStorage/*!*/ lessThanStorage, + UnaryOpStorage/*!*/ minusStorage, RubyContext/*!*/ context, object self) { - var lessThan = lessThanStorage.GetCallSite("<", 1); + var lessThan = lessThanStorage.GetCallSite("<"); if (RubyOps.IsTrue(lessThan.Target(lessThan, context, self, 0))) { - var minus = minusStorage.GetCallSite("-@", 0); + var minus = minusStorage.GetCallSite("-@"); return minus.Target(minus, context, self); } return self; @@ -110,22 +104,6 @@ #endregion - #region ceil - - /// - /// Returns the smallest Integer greater than or equal to num. - /// - /// - /// This is achieved by converting self to a Float then directly calling Float#ceil. - /// - [RubyMethod("ceil")] - public static object Ceil(RubyContext/*!*/ context, object self) { - double floatSelf = Protocols.ConvertToFloat(context, self); - return FloatOps.Ceil(floatSelf); - } - - #endregion - #region coerce /// @@ -155,10 +133,10 @@ /// [RubyMethod("div")] public static object Div( - SiteLocalStorage/*!*/ divideStorage, + BinaryOpStorage/*!*/ divideStorage, RubyContext/*!*/ context, object self, object other) { - var divide = divideStorage.GetCallSite("/", 1); + var divide = divideStorage.GetCallSite("/"); return Floor(context, divide.Target(divide, context, self, other)); } #endregion @@ -177,13 +155,13 @@ /// [RubyMethod("divmod")] public static RubyArray DivMod( - SiteLocalStorage/*!*/ divideStorage, - SiteLocalStorage/*!*/ moduloStorage, + BinaryOpStorage/*!*/ divideStorage, + BinaryOpStorage/*!*/ moduloStorage, RubyContext/*!*/ context, object self, object other) { object div = Div(divideStorage, context, self, other); - var modulo = moduloStorage.GetCallSite("modulo", 1); + var modulo = moduloStorage.GetCallSite("modulo"); object mod = modulo.Target(modulo, context, self, other); return RubyOps.MakeArray2(div, mod); @@ -195,22 +173,30 @@ /// /// Returns true if num and numeric are the same type and have equal values. /// - /// - /// - /// - /// [RubyMethod("eql?")] - public static bool Eql(RubyContext/*!*/ context, object self, object other) { + public static bool Eql(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, object self, object other) { if (context.GetClassOf(self) != context.GetClassOf(other)) { return false; } - return Protocols.IsEqual(context, self, other); + return Protocols.IsEqual(equals, context, self, other); } #endregion - #region floor + #region round, floor, ceil, truncate + /// + /// Rounds self to the nearest integer. + /// + /// + /// This is achieved by converting self to a Float and directly calling Float#round. + /// + [RubyMethod("round")] + public static object Round(RubyContext/*!*/ context, object self) { + return FloatOps.Round(Protocols.ConvertToFloat(context, self)); + } + + /// /// Returns the largest integer less than or equal to self. /// /// @@ -220,6 +206,29 @@ public static object Floor(RubyContext/*!*/ context, object self) { return FloatOps.Floor(Protocols.ConvertToFloat(context, self)); } + + /// + /// Returns the smallest Integer greater than or equal to num. + /// + /// + /// This is achieved by converting self to a Float then directly calling Float#ceil. + /// + [RubyMethod("ceil")] + public static object Ceil(RubyContext/*!*/ context, object/*!*/ self) { + return FloatOps.Ceil(Protocols.ConvertToFloat(context, self)); + } + + /// + /// Returns self truncated to an integer. + /// + /// + /// This is achieved by converting self to a float and directly calling Float#truncate. + /// + [RubyMethod("truncate")] + public static object Truncate(RubyContext/*!*/ context, object self) { + return FloatOps.ToInt(Protocols.ConvertToFloat(context, self)); + } + #endregion #region integer? @@ -242,10 +251,10 @@ /// [RubyMethod("modulo")] public static object Modulo( - SiteLocalStorage/*!*/ moduloStorage, + BinaryOpStorage/*!*/ moduloStorage, RubyContext/*!*/ context, object self, object other) { - var modulo = moduloStorage.GetCallSite("%", 1); + var modulo = moduloStorage.GetCallSite("%"); return modulo.Target(modulo, context, self, other); } @@ -267,8 +276,8 @@ /// returning nil if it is or self otherwise. /// [RubyMethod("nonzero?")] - public static object IsNonZero(SiteLocalStorage/*!*/ isZeroStorage, RubyContext/*!*/ context, object self) { - var isZero = isZeroStorage.GetCallSite("zero?", 0); + public static object IsNonZero(UnaryOpStorage/*!*/ isZeroStorage, RubyContext/*!*/ context, object self) { + var isZero = isZeroStorage.GetCallSite("zero?"); return Protocols.IsTrue(isZero.Target(isZero, context, self)) ? null : self; } @@ -279,10 +288,10 @@ /// Equivalent to invoking Numeric#/; overridden in subclasses /// [RubyMethod("quo")] - public static object Quo(SiteLocalStorage/*!*/ divideStorage, + public static object Quo(BinaryOpStorage/*!*/ divideStorage, RubyContext/*!*/ context, object self, object other) { - var site = divideStorage.GetCallSite("/", 1); + var site = divideStorage.GetCallSite("/"); return site.Target(site, context, self, other); } #endregion @@ -299,24 +308,25 @@ /// [RubyMethod("remainder")] public static object Remainder( - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ minusStorage, - SiteLocalStorage/*!*/ moduloStorage, + BinaryOpStorage/*!*/ equals, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ minusStorage, + BinaryOpStorage/*!*/ moduloStorage, RubyContext/*!*/ context, object self, object other) { - var modulo = moduloStorage.GetCallSite("%", 1); + var modulo = moduloStorage.GetCallSite("%"); object remainder = modulo.Target(modulo, context, self, other); - if (!Protocols.IsEqual(context, remainder, 0)) { - var greaterThan = greaterThanStorage.GetCallSite(">", 1); - var lessThan = lessThanStorage.GetCallSite("<", 1); + if (!Protocols.IsEqual(equals, context, remainder, 0)) { + var greaterThan = greaterThanStorage.GetCallSite(">"); + var lessThan = lessThanStorage.GetCallSite("<"); // modulo is not zero if (RubyOps.IsTrue(lessThan.Target(lessThan, context, self, 0)) && RubyOps.IsTrue(greaterThan.Target(greaterThan, context, other, 0)) || RubyOps.IsTrue(greaterThan.Target(greaterThan, context, self, 0)) && RubyOps.IsTrue(lessThan.Target(lessThan, context, other, 0))) { // (self is negative and other is positive) OR (self is positive and other is negative) - var minus = minusStorage.GetCallSite("-", 1); + var minus = minusStorage.GetCallSite("-"); return minus.Target(minus, context, remainder, other); } } @@ -326,20 +336,6 @@ #endregion - #region round - /// - /// Rounds self to the nearest integer. - /// - /// - /// This is achieved by converting self to a Float and directly calling Float#round. - /// - [RubyMethod("round")] - public static object Round(RubyContext/*!*/ context, object self) { - double floatSelf = Protocols.ConvertToFloat(context, self); - return FloatOps.Round(floatSelf); - } - #endregion - #region step /// @@ -411,9 +407,10 @@ /// [RubyMethod("step")] public static object Step( - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ addStorage, + BinaryOpStorage/*!*/ equals, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ addStorage, RubyContext/*!*/ context, BlockParam block, object self, object limit, [Optional]object step) { if (step == Missing.Value) { @@ -442,14 +439,14 @@ // return self #endregion - bool isStepZero = Protocols.IsEqual(context, step, 0); + bool isStepZero = Protocols.IsEqual(equals, context, step, 0); if (isStepZero) { throw RubyExceptions.CreateArgumentError("step can't be 0"); } - var greaterThan = greaterThanStorage.GetCallSite(">", 1); + var greaterThan = greaterThanStorage.GetCallSite(">"); bool isStepPositive = RubyOps.IsTrue(greaterThan.Target(greaterThan, context, step, 0)); - var compare = isStepPositive ? greaterThan : lessThanStorage.GetCallSite("<", 1); + var compare = isStepPositive ? greaterThan : lessThanStorage.GetCallSite("<"); object current = self; while (!RubyOps.IsTrue(compare.Target(compare, context, current, limit))) { @@ -458,7 +455,7 @@ return result; } - var add = addStorage.GetCallSite("+", 1); + var add = addStorage.GetCallSite("+"); current = add.Target(add, context, current, step); } return self; @@ -476,37 +473,28 @@ #endregion #region to_int + /// /// Invokes the self.to_i method to convert self to an integer. /// [RubyMethod("to_int")] - public static object ToInt(RubyContext/*!*/ context, object self) { - return RubySites.ToI(context, self); + public static object ToInt(UnaryOpStorage/*!*/ toiStorage, RubyContext/*!*/ context, object self) { + var site = toiStorage.GetCallSite("to_i"); + return site.Target(site, context, self); } + #endregion - #region truncate - /// - /// Returns self truncated to an integer. - /// - /// - /// This is achieved by converting self to a float and directly calling Float#truncate. - /// - [RubyMethod("truncate")] - public static object Truncate(RubyContext/*!*/ context, object self) { - double floatSelf = Protocols.ConvertToFloat(context, self); - return FloatOps.ToInt(floatSelf); - } - #endregion - #region zero? + /// /// Returns true if self has a zero value. /// [RubyMethod("zero?")] - public static bool IsZero(RubyContext/*!*/ context, object self) { - return Protocols.IsEqual(context, self, 0); + public static bool IsZero(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, object self) { + return Protocols.IsEqual(equals, context, self, 0); } + #endregion } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Precision.cs;C659171 File: Precision.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Precision.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Precision.cs;MoreSites4 @@ -35,7 +35,7 @@ /// So, if klass.induced_from doesn't return an instance of klass, it will be necessary to reimplement prec. /// [RubyMethod("prec")] - public static object Prec(SiteLocalStorage>>/*!*/ inducedFromStorage, + public static object Prec(CallSiteStorage>/*!*/ inducedFromStorage, object self, [NotNull]RubyClass/*!*/ klass) { var inducedFrom = inducedFromStorage.GetCallSite("induced_from", 1); @@ -47,7 +47,7 @@ /// [RubyMethod("prec_i")] public static object PrecInteger( - SiteLocalStorage>>/*!*/ precStorage, + CallSiteStorage>/*!*/ precStorage, RubyContext/*!*/ context, object self) { var prec = precStorage.GetCallSite("prec", 1); @@ -58,7 +58,7 @@ /// Returns a Float converted from self. It is equivalent to prec(Float). /// [RubyMethod("prec_f")] - public static object PrecFloat(SiteLocalStorage>>/*!*/ precStorage, + public static object PrecFloat(CallSiteStorage>/*!*/ precStorage, RubyContext/*!*/ context, object self) { var prec = precStorage.GetCallSite("prec", 1); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;C659171 File: ProcOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;MoreSites4 @@ -126,7 +126,7 @@ #region Singleton Methods [RubyMethod("new", RubyMethodAttributes.PublicSingleton)] - public static Proc/*!*/ CreateNew(SiteLocalStorage>>/*!*/ storage, + public static Proc/*!*/ CreateNew(CallSiteStorage>/*!*/ storage, RubyScope/*!*/ scope, RubyClass/*!*/ self) { RubyMethodScope methodScope = scope.GetInnerMostMethodScope(); @@ -138,7 +138,7 @@ } [RubyMethod("new", RubyMethodAttributes.PublicSingleton)] - public static Proc/*!*/ CreateNew(SiteLocalStorage>>/*!*/ storage, + public static Proc/*!*/ CreateNew(CallSiteStorage>/*!*/ storage, BlockParam/*!*/ block, RubyClass/*!*/ self) { if (block == null) { @@ -148,7 +148,7 @@ return CreateNew(storage, self, block.Proc); } - public static Proc/*!*/ CreateNew(SiteLocalStorage>>/*!*/ storage, + public static Proc/*!*/ CreateNew(CallSiteStorage>/*!*/ storage, RubyClass/*!*/ self, Proc/*!*/ proc) { Assert.NotNull(storage, self, proc); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RangeOps.cs;C659171 File: RangeOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RangeOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RangeOps.cs;MoreSites4 @@ -16,12 +16,6 @@ using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; -using UnaryOpSite = System.Runtime.CompilerServices.CallSite>; - -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -68,14 +62,14 @@ /// RubyOps.CreateExclusiveRange which bypass this constructor/initializer run about and initialize the object directly. /// [RubyConstructor] - public static Range/*!*/ CreateRange(SiteLocalStorage/*!*/ comparisonStorage, + public static Range/*!*/ CreateRange(BinaryOpStorage/*!*/ comparisonStorage, RubyClass/*!*/ self, object begin, object end, [Optional]bool excludeEnd) { return new Range(comparisonStorage, self.Context, begin, end, excludeEnd); } // Reinitialization. Not called when a factory/non-default ctor is called. [RubyMethod("initialize", RubyMethodAttributes.PrivateInstance)] - public static Range/*!*/ Reinitialize(SiteLocalStorage/*!*/ comparisonStorage, + public static Range/*!*/ Reinitialize(BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, Range/*!*/ self, object begin, object end, [Optional]bool excludeEnd) { self.Initialize(comparisonStorage, context, begin, end, excludeEnd); return self; @@ -129,16 +123,18 @@ #endregion #region to_s + /// /// Convert this range object to a printable form (using to_s to convert the start and end objects). /// [RubyMethod("to_s")] - public static MutableString/*!*/ ToS(RubyContext/*!*/ context, Range/*!*/ self) { - MutableString str = RubySites.ToS(context, self.Begin); + public static MutableString/*!*/ ToS(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, Range/*!*/ self) { + MutableString str = RubyUtils.ObjectToMutableString(tosStorage, context, self.Begin); str.Append(self.ExcludeEnd ? "..." : ".."); - str.Append(RubySites.ToS(context, self.End)); + str.Append(RubyUtils.ObjectToMutableString(tosStorage, context, self.End)); return str; } + #endregion #region ==, eql? @@ -162,13 +158,13 @@ /// (0..2).eql?(0.0..2.0) #=> true /// [RubyMethod("==")] - public static bool Equals(RubyContext/*!*/ context, Range/*!*/ self, [NotNull]Range/*!*/ other) { + public static bool Equals(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, Range/*!*/ self, [NotNull]Range/*!*/ other) { if (self == other) { return true; } - return (Protocols.IsEqual(context, self.Begin, other.Begin) - && Protocols.IsEqual(context, self.End, other.End) - && self.ExcludeEnd == other.ExcludeEnd); + return Protocols.IsEqual(equals, context, self.Begin, other.Begin) + && Protocols.IsEqual(equals, context, self.End, other.End) + && self.ExcludeEnd == other.ExcludeEnd; } /// @@ -182,14 +178,14 @@ /// (0..2).eql?(0.0..2.0) #=> false /// [RubyMethod("eql?")] - public static bool Eql(SiteLocalStorage/*!*/ equalsStorage, + public static bool Eql(BinaryOpStorage/*!*/ equalsStorage, RubyContext/*!*/ context, Range/*!*/ self, [NotNull]Range/*!*/ other) { if (self == other) { return true; } - var site = equalsStorage.GetCallSite("eql?", 1); + var site = equalsStorage.GetCallSite("eql?"); return Protocols.IsTrue(site.Target(site, context, self.Begin, other.Begin)) && Protocols.IsTrue(site.Target(site, context, self.End, other.End)) && self.ExcludeEnd == other.ExcludeEnd; @@ -213,12 +209,12 @@ /// [RubyMethod("==="), RubyMethod("member?"), RubyMethod("include?")] public static bool CaseEquals( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, [NotNull]Range/*!*/ self, object value) { - var compare = comparisonStorage.GetCallSite("<=>", 1); + var compare = comparisonStorage.GetCallSite("<=>"); object result = compare.Target(compare, context, self.Begin, value); if (result == null || Protocols.ConvertCompareResult(lessThanStorage, greaterThanStorage, context, result) > 0) { @@ -259,12 +255,13 @@ /// [RubyMethod("each")] public static object Each( - SiteLocalStorage/*!*/ respondToStorage, - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ equalsStorage, - SiteLocalStorage/*!*/ succStorage, + ConversionStorage/*!*/ stringCast, + RespondToStorage/*!*/ respondToStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ equalsStorage, + UnaryOpStorage/*!*/ succStorage, RubyContext/*!*/ context, BlockParam block, Range/*!*/ self) { // We check that self.begin responds to "succ" even though some of the implementations don't use it. @@ -273,7 +270,7 @@ if (self.Begin is int && self.End is int) { return StepFixnum(context, block, self, (int)self.Begin, (int)self.End, 1); } else if (self.Begin is MutableString) { - return StepString(comparisonStorage, lessThanStorage, greaterThanStorage, succStorage, context, + return StepString(stringCast, comparisonStorage, lessThanStorage, greaterThanStorage, succStorage, context, block, self, (MutableString)self.Begin, (MutableString)self.End, 1 ); } else { @@ -294,14 +291,16 @@ /// [RubyMethod("step")] public static object Step( - SiteLocalStorage/*!*/ respondToStorage, - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ lessThanEqualsStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ equalsStorage, - SiteLocalStorage/*!*/ addStorage, - SiteLocalStorage/*!*/ succStorage, + ConversionStorage/*!*/ stringCast, + ConversionStorage/*!*/ fixnumCast, + RespondToStorage/*!*/ respondToStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ lessThanEqualsStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ equalsStorage, + BinaryOpStorage/*!*/ addStorage, + UnaryOpStorage/*!*/ succStorage, RubyContext/*!*/ context, BlockParam block, Range/*!*/ self, [Optional]object step) { if (step == Missing.Value) { @@ -312,12 +311,12 @@ // This prevents cases such as (1.0..2.0).step(0x800000000000000) {|x| x } from working but that is what MRI does. if (self.Begin is int && self.End is int) { // self.begin is Fixnum; directly call item = item + 1 instead of succ - int intStep = Protocols.CastToFixnum(context, step); + int intStep = Protocols.CastToFixnum(fixnumCast, context, step); return StepFixnum(context, block, self, (int)self.Begin, (int)self.End, intStep); } else if (self.Begin is MutableString ) { // self.begin is String; use item.succ and item <=> self.end but make sure you check the length of the strings - int intStep = Protocols.CastToFixnum(context, step); - return StepString(comparisonStorage, lessThanStorage, greaterThanStorage, succStorage, context, + int intStep = Protocols.CastToFixnum(fixnumCast, context, step); + return StepString(stringCast, comparisonStorage, lessThanStorage, greaterThanStorage, succStorage, context, block, self, (MutableString)self.Begin, (MutableString)self.End, intStep ); } else if (context.IsInstanceOf(self.Begin, context.GetClass(typeof(Numeric)))) { @@ -328,7 +327,7 @@ } else { // self.begin is not Numeric or String; just invoke item.succ and item <=> self.end CheckBegin(respondToStorage, context, self.Begin); - int intStep = Protocols.CastToFixnum(context, step); + int intStep = Protocols.CastToFixnum(fixnumCast, context, step); return StepObject(comparisonStorage, lessThanStorage, greaterThanStorage, equalsStorage, succStorage, context, block, self, self.Begin, self.End, intStep ); @@ -379,10 +378,11 @@ /// It uses a hybrid string comparison to prevent infinite loops and calls String#succ to get each item in the range. /// private static object StepString( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ succStorage, + ConversionStorage/*!*/ stringCast, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + UnaryOpStorage/*!*/ succStorage, RubyContext/*!*/ context, BlockParam block, Range/*!*/ self, MutableString begin, MutableString end, int step) { CheckStep(step); @@ -390,7 +390,7 @@ MutableString item = begin; int comp; - var succSite = succStorage.GetCallSite("succ", 0); + var succSite = succStorage.GetCallSite("succ"); while ((comp = Protocols.Compare(comparisonStorage, lessThanStorage, greaterThanStorage, context, item, end)) < 0) { if (block == null) { throw RubyExceptions.NoBlockGiven(); @@ -401,7 +401,7 @@ } for (int i = 0; i < step; i++) { - item = Protocols.CastToString(context, succSite.Target(succSite, context, item)); + item = Protocols.CastToString(stringCast, context, succSite.Target(succSite, context, item)); } if (item.Length > end.Length) { @@ -425,20 +425,20 @@ /// Step through a Range of Numerics. /// private static object StepNumeric( - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ lessThanEqualsStorage, - SiteLocalStorage/*!*/ equalsStorage, - SiteLocalStorage/*!*/ addStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ lessThanEqualsStorage, + BinaryOpStorage/*!*/ equalsStorage, + BinaryOpStorage/*!*/ addStorage, RubyContext/*!*/ context, BlockParam block, Range/*!*/ self, object begin, object end, object step) { - var lessThan = lessThanStorage.GetCallSite("<", 1); - var equals = equalsStorage.GetCallSite("==", 1); + var lessThan = lessThanStorage.GetCallSite("<"); + var equals = equalsStorage.GetCallSite("=="); CheckStep(lessThan, equals, context, step); object item = begin; object result; - var site = self.ExcludeEnd ? lessThan : lessThanEqualsStorage.GetCallSite("<=", 1); + var site = self.ExcludeEnd ? lessThan : lessThanEqualsStorage.GetCallSite("<="); while (RubyOps.IsTrue(site.Target(site, context, item, end))) { if (block == null) { throw RubyExceptions.NoBlockGiven(); @@ -448,7 +448,7 @@ return result; } - var add = addStorage.GetCallSite("+", 1); + var add = addStorage.GetCallSite("+"); item = add.Target(add, context, item, step); } @@ -459,19 +459,19 @@ /// Step through a Range of objects that are not Numeric or String. /// private static object StepObject( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, - SiteLocalStorage/*!*/ equalsStorage, - SiteLocalStorage/*!*/ succStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ equalsStorage, + UnaryOpStorage/*!*/ succStorage, RubyContext/*!*/ context, BlockParam block, Range/*!*/ self, object begin, object end, int step) { - CheckStep(lessThanStorage.GetCallSite("<", 1), equalsStorage.GetCallSite("==", 1), context, step); + CheckStep(lessThanStorage.GetCallSite("<"), equalsStorage.GetCallSite("=="), context, step); object item = begin, result; int comp; - var succSite = succStorage.GetCallSite("succ", 0); + var succSite = succStorage.GetCallSite("succ"); while ((comp = Protocols.Compare(comparisonStorage, lessThanStorage, greaterThanStorage, context, item, end)) < 0) { if (block == null) { throw RubyExceptions.NoBlockGiven(); @@ -530,7 +530,7 @@ /// /// Check that the object responds to "succ". /// - private static void CheckBegin(SiteLocalStorage/*!*/ respondToStorage, + private static void CheckBegin(RespondToStorage/*!*/ respondToStorage, RubyContext/*!*/ context, object begin) { if (!Protocols.RespondTo(respondToStorage, context, begin, "succ")) { throw RubyExceptions.CreateTypeError(String.Format("can't iterate from {0}", RubyUtils.GetClassName(context, begin))); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RubyRegexOps.cs;C641155 File: RubyRegexOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RubyRegexOps.cs;C641155 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/RubyRegexOps.cs;MoreSites4 @@ -320,8 +320,8 @@ } [RubyMethod("~")] - public static object ImplicitMatch(RubyScope/*!*/ scope, RubyRegex/*!*/ self) { - return MatchIndex(scope, self, Protocols.CastToString(scope.RubyContext, scope.GetInnerMostClosureScope().LastInputLine)); + public static object ImplicitMatch(ConversionStorage/*!*/ stringCast, RubyScope/*!*/ scope, RubyRegex/*!*/ self) { + return MatchIndex(scope, self, Protocols.CastToString(stringCast, scope.RubyContext, scope.GetInnerMostClosureScope().LastInputLine)); } [RubyMethod("source")] @@ -346,7 +346,7 @@ } [RubyMethod("union", RubyMethodAttributes.PublicSingleton)] - public static RubyRegex/*!*/ Union(RubyClass/*!*/ self, [NotNull]params object[]/*!*/ strings) { + public static RubyRegex/*!*/ Union(ConversionStorage/*!*/ stringCast, RubyClass/*!*/ self, [NotNull]params object[]/*!*/ strings) { if (strings.Length == 0) { return new RubyRegex("(?!)", RubyRegexOptions.NONE); @@ -366,7 +366,7 @@ Append(regex, result); } else { - result.Append(RubyRegex.Escape(Protocols.CastToString(self.Context, strings[i]))); + result.Append(RubyRegex.Escape(Protocols.CastToString(stringCast, self.Context, strings[i]))); } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs;C659171 File: StringFormatter.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs;MoreSites4 @@ -83,12 +83,18 @@ private StringBuilder _buf; + private readonly ConversionStorage/*!*/ _fixnumCast; + private readonly ConversionStorage/*!*/ _tosConversion; #region Constructors - internal StringFormatter(RubyContext/*!*/ context, string/*!*/ format, IList/*!*/ data) { + internal StringFormatter(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ tosConversion, + RubyContext/*!*/ context, string/*!*/ format, IList/*!*/ data) { Assert.NotNull(context, format, data); + // TODO: Assert.NotNull(fixnumCast,tosConversion) + _fixnumCast = fixnumCast; + _tosConversion = tosConversion; _format = format; _data = data; _context = context; @@ -204,7 +210,7 @@ int? argindex = TryReadArgumentIndex(); _curCh = _format[_index++]; - res = Protocols.CastToFixnum(_context, GetData(argindex)); + res = Protocols.CastToFixnum(_fixnumCast, _context, GetData(argindex)); } else { if (Char.IsDigit(_curCh)) { res = 0; @@ -291,7 +297,7 @@ } private void AppendChar() { - int fixChar = Protocols.CastToFixnum(_context, _opts.Value); + int fixChar = Protocols.CastToFixnum(_fixnumCast, _context, _opts.Value); fixChar = fixChar > 0 ? fixChar % 256 : ((-fixChar / 256) + 1) * 256 + fixChar; char val = (char)fixChar; if (_opts.FieldWidth > 1) { @@ -760,8 +766,13 @@ /// for BigInteger below that should be kept in sync. /// private void AppendBase(char format, int radix) { - object value = Protocols.ConvertToInteger(_context, _opts.Value); + BigInteger bignum; + int fixnum; + Protocols.ConvertToInteger(_context, _opts.Value, out fixnum, out bignum); + // TODO: split paths for bignum and fixnum + object value = ((object)bignum) ?? fixnum; + bool isNegative = IsNegative(value); if (isNegative) { // These options mean we're not looking at the one's complement @@ -882,7 +893,7 @@ } private void AppendString() { - MutableString/*!*/ str = Protocols.ConvertToString(_context, _opts.Value); + MutableString/*!*/ str = Protocols.ConvertToString(_tosConversion, _context, _opts.Value); if (KernelOps.Tainted(_context, str)) { _tainted = true; } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs;C660056 File: StructOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs;C660056 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs;MoreSites4 @@ -24,8 +24,9 @@ using Microsoft.Scripting.Actions; using IronRuby.Runtime; using IronRuby.Runtime.Calls; +using System.Runtime.InteropServices; using Ast = System.Linq.Expressions.Expression; -using System.Runtime.InteropServices; +using EachSite = System.Func; namespace IronRuby.Builtins { @@ -136,8 +137,8 @@ } [RubyMethod("[]")] - public static object GetValue(RubyStruct/*!*/ self, object index) { - return self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(self.Class.Context, index))]; + public static object GetValue(ConversionStorage/*!*/ conversionStorage, RubyStruct/*!*/ self, object index) { + return self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(conversionStorage, self.Class.Context, index))]; } [RubyMethod("[]=")] @@ -156,8 +157,8 @@ } [RubyMethod("[]=")] - public static object SetValue(RubyStruct/*!*/ self, object index, object value) { - return self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(self.Class.Context, index))] = value; + public static object SetValue(ConversionStorage/*!*/ conversionStorage, RubyStruct/*!*/ self, object index, object value) { + return self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(conversionStorage, self.Class.Context, index))] = value; } [RubyMethod("each")] @@ -210,16 +211,19 @@ // same pattern as RubyStruct.Equals, but we need to call == instead of eql? [RubyMethod("==")] - public static bool Equals(RubyStruct/*!*/ self, object obj) { + public static bool Equals(BinaryOpStorage/*!*/ equals, RubyStruct/*!*/ self, object obj) { var other = obj as RubyStruct; if (!self.StructReferenceEquals(other)) { return false; } + Debug.Assert(self.ItemCount == other.ItemCount); - Debug.Assert(self.ItemCount == other.ItemCount); - for (int i = 0; i < self.Values.Length; i++) { - if (!RubySites.Equal(self.Class.Context, self.Values[i], other.Values[i])) { - return false; + if (self.Values.Length > 0) { + var site = equals.GetCallSite("=="); + for (int i = 0; i < self.Values.Length; i++) { + if (RubyOps.IsFalse(site.Target(site, self.Class.Context, self.Values[i], other.Values[i]))) { + return false; + } } } @@ -259,24 +263,24 @@ // For some unknown reason Struct defines the method even though it is mixed in from Enumerable // Until we discover the difference, delegate to Enumerable#select [RubyMethod("select")] - public static RubyArray/*!*/ Select(BlockParam predicate, RubyStruct/*!*/ self) { - return Enumerable.Select(self.Class.Context, predicate, self); + public static RubyArray/*!*/ Select(CallSiteStorage/*!*/ each, BlockParam predicate, RubyStruct/*!*/ self) { + return Enumerable.Select(each, self.Class.Context, predicate, self); } // equivalent to Array#values_at over the data array [RubyMethod("values_at")] - public static RubyArray/*!*/ ValuesAt(RubyStruct/*!*/ self, [NotNull]params object[] values) { + public static RubyArray/*!*/ ValuesAt(ConversionStorage/*!*/ fixnumCast, RubyStruct/*!*/ self, [NotNull]params object[] values) { RubyArray result = new RubyArray(); + RubyContext context = self.Class.Context; object[] data = self.Values; for (int i = 0; i < values.Length; ++i) { Range range = values[i] as Range; if (range != null) { - bool excludeEnd; - int begin, end; - Protocols.ConvertToIntegerRange(self.Class.Context, range, out begin, out end, out excludeEnd); + int begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); - if (excludeEnd) { + if (range.ExcludeEnd) { end -= 1; } @@ -291,7 +295,7 @@ } } } else { - int index = NormalizeIndex(data.Length, Protocols.CastToFixnum(self.Class.Context, values[i])); + int index = NormalizeIndex(data.Length, Protocols.CastToFixnum(fixnumCast, context, values[i])); result.Add(data[index]); } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;C669880 File: ThreadOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;MoreSites4 @@ -23,6 +23,7 @@ using Microsoft.Scripting.Utils; using System.Threading; using IronRuby.Runtime; +using System.Text; namespace IronRuby.Builtins { [RubyClass("Thread", Extends = typeof(Thread), Inherits = typeof(object))] @@ -148,9 +149,8 @@ if (key == null) { return RubyExceptions.CreateTypeError("nil is not a symbol"); } else { - MutableString repr = Protocols.ConvertToString(context, key); - string message = String.Format("{0} is not a symbol", repr.ToString()); - return RubyExceptions.CreateArgumentError(message); + // MRI calls RubyUtils.InspectObject, but this should be good enought as an error message: + return RubyExceptions.CreateArgumentError(String.Format("{0} is not a symbol", context.GetClassOf(key).Name)); } } @@ -425,13 +425,19 @@ } catch (Exception e) { info.Exception = e; - Utils.Log( - e.Message + "\r\n\r\n" + - e.StackTrace + "\r\n\r\n" + - IListOps.Join(context, RubyExceptionData.GetInstance(e).Backtrace).ToString(), - "THREAD" - ); + StringBuilder trace = new StringBuilder(); + trace.Append(e.Message); + trace.AppendLine(); + trace.AppendLine(); + trace.Append(e.StackTrace); + trace.AppendLine(); + trace.AppendLine(); + foreach (var frame in RubyExceptionData.GetInstance(e).Backtrace) { + trace.Append(frame.ToString()); + } + Utils.Log(trace.ToString(), "THREAD"); + if (_globalAbortOnException || info.AbortOnException) { throw; } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs;C633889 File: TimeOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs;MoreSites4 @@ -121,22 +121,30 @@ return new DateTime(year, month, day, hour, minute, second).AddTicks(microsecond*10); } - private static int GetComponent(RubyContext/*!*/ context, object[] components, int index, int defValue) { + private static int GetComponent(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, object[] components, int index, int defValue) { if (index >= components.Length || components[index] == null) { return defValue; } - return Protocols.CastToFixnum(context, components[index]); + return Protocols.CastToFixnum(conversionStorage, context, components[index]); } [RubyMethod("local", RubyMethodAttributes.PublicSingleton)] [RubyMethod("mktime", RubyMethodAttributes.PublicSingleton)] - public static DateTime CreateLocalTime(RubyContext/*!*/ context, object/*!*/ self, [NotNull]params object[]/*!*/ components) { + public static DateTime CreateLocalTime(ConversionStorage/*!*/ conversionStorage, + RubyContext/*!*/ context, object/*!*/ self, [NotNull]params object[]/*!*/ components) { + if (components.Length > 7 || components.Length == 0) { throw RubyExceptions.CreateArgumentError(String.Format("wrong number of arguments ({0} for 7)", components.Length)); } - return new DateTime(Protocols.CastToFixnum(context, components[0]), GetComponent(context, components, 1, 1), - GetComponent(context, components, 2, 1), GetComponent(context, components, 3, 0), GetComponent(context, components, 4, 0), - GetComponent(context, components, 5, 0), GetComponent(context, components, 6, 0)); + + return new DateTime(Protocols.CastToFixnum(conversionStorage, context, components[0]), + GetComponent(conversionStorage, context, components, 1, 1), + GetComponent(conversionStorage, context, components, 2, 1), + GetComponent(conversionStorage, context, components, 3, 0), + GetComponent(conversionStorage, context, components, 4, 0), + GetComponent(conversionStorage, context, components, 5, 0), + GetComponent(conversionStorage, context, components, 6, 0) + ); } #endregion @@ -187,13 +195,21 @@ [RubyMethod("utc", RubyMethodAttributes.PublicSingleton)] [RubyMethod("gm", RubyMethodAttributes.PublicSingleton)] - public static DateTime CreateGmtTime(RubyContext/*!*/ context, object/*!*/ self, [NotNull]params object[]/*!*/ components) { + public static DateTime CreateGmtTime(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, object/*!*/ self, + [NotNull]params object[]/*!*/ components) { + if (components.Length > 7 || components.Length == 0) { throw RubyExceptions.CreateArgumentError(String.Format("wrong number of arguments ({0} for 7)", components.Length)); } - return new DateTime(Protocols.CastToFixnum(context, components[0]), GetComponent(context, components, 1, 1), - GetComponent(context, components, 2, 1), GetComponent(context, components, 3, 0), GetComponent(context, components, 4, 0), - GetComponent(context, components, 5, 0), DateTimeKind.Utc).AddTicks(GetComponent(context, components, 6, 0)*10); + return new DateTime( + Protocols.CastToFixnum(conversionStorage, context, components[0]), + GetComponent(conversionStorage, context, components, 1, 1), + GetComponent(conversionStorage, context, components, 2, 1), + GetComponent(conversionStorage, context, components, 3, 0), + GetComponent(conversionStorage, context, components, 4, 0), + GetComponent(conversionStorage, context, components, 5, 0), DateTimeKind.Utc).AddTicks( + GetComponent(conversionStorage, context, components, 6, 0) * 10 + ); } #endregion =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Digest/Digest.cs;C659171 File: Digest.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Digest/Digest.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Digest/Digest.cs;MoreSites4 @@ -118,13 +118,17 @@ public class Class { [RubyMethod("digest", RubyMethodAttributes.PublicSingleton)] - public static MutableString Digest(SiteLocalStorage>>/*!*/ storage, + public static MutableString Digest( + CallSiteStorage>/*!*/ allocateStorage, + CallSiteStorage>/*!*/ digestStorage, RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ str) { // TODO: new? - object obj = RubySites.Allocate(self); + var allocateSite = allocateStorage.GetCallSite("allocate", 0); + object obj = allocateSite.Target(allocateSite, self.Context, self); + // TODO: check obj - var site = storage.GetCallSite("digest", 1); + var site = digestStorage.GetCallSite("digest", 1); return site.Target(site, self.Context, obj, str); } @@ -134,7 +138,7 @@ } [RubyMethod("hexdigest", RubyMethodAttributes.PublicSingleton)] - public static MutableString/*!*/ HexDigest(SiteLocalStorage>>/*!*/ storage, + public static MutableString/*!*/ HexDigest(CallSiteStorage>/*!*/ storage, RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ str) { var site = storage.GetCallSite("digest", 1); @@ -165,10 +169,14 @@ public class Instance { [RubyMethod("digest")] - public static MutableString Digest(SiteLocalStorage>>/*!*/ finishStorage, + public static MutableString Digest( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + CallSiteStorage>/*!*/ finishStorage, RubyContext/*!*/ context, object self) { + object clone; - if (!RubyUtils.TryDuplicateObject(context, self, true, out clone)) { + if (!RubyUtils.TryDuplicateObject(initializeCopyStorage, allocateStorage, context, self, true, out clone)) { throw RubyExceptions.CreateArgumentError("unable to copy object"); } @@ -179,9 +187,9 @@ [RubyMethod("digest")] public static MutableString Digest( - SiteLocalStorage>>/*!*/ updateStorage, - SiteLocalStorage>>/*!*/ finishStorage, - SiteLocalStorage>>/*!*/ resetStorage, + CallSiteStorage>/*!*/ updateStorage, + CallSiteStorage>/*!*/ finishStorage, + CallSiteStorage>/*!*/ resetStorage, RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ str) { var update = updateStorage.GetCallSite("update", 1); @@ -199,8 +207,8 @@ [RubyMethod("digest!")] public static MutableString DigestNew( - SiteLocalStorage>>/*!*/ finishStorage, - SiteLocalStorage>>/*!*/ resetStorage, + CallSiteStorage>/*!*/ finishStorage, + CallSiteStorage>/*!*/ resetStorage, RubyContext/*!*/ context, object self) { var finish = finishStorage.GetCallSite("finish", 0); @@ -215,24 +223,27 @@ [RubyMethod("hexdigest")] public static MutableString HexDigest( - SiteLocalStorage>>/*!*/ finishStorage, + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + CallSiteStorage>/*!*/ finishStorage, RubyContext/*!*/ context, object self) { - return Class.HexEncode(Digest(finishStorage, context, self)); + + return Class.HexEncode(Digest(initializeCopyStorage, allocateStorage, finishStorage, context, self)); } [RubyMethod("hexdigest")] public static MutableString HexDigest( - SiteLocalStorage>>/*!*/ updateStorage, - SiteLocalStorage>>/*!*/ finishStorage, - SiteLocalStorage>>/*!*/ resetStorage, + CallSiteStorage>/*!*/ updateStorage, + CallSiteStorage>/*!*/ finishStorage, + CallSiteStorage>/*!*/ resetStorage, RubyContext/*!*/ context, object self, [DefaultProtocol, NotNull]MutableString/*!*/ str) { return Class.HexEncode(Digest(updateStorage, finishStorage, resetStorage, context, self, str)); } [RubyMethod("hexdigest!")] public static MutableString HexDigestNew( - SiteLocalStorage>>/*!*/ finishStorage, - SiteLocalStorage>>/*!*/ resetStorage, + CallSiteStorage>/*!*/ finishStorage, + CallSiteStorage>/*!*/ resetStorage, RubyContext/*!*/ context, object self) { return Class.HexEncode(DigestNew(finishStorage, resetStorage, context, self)); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs;C659171 File: IDictionaryOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Collections.Generic; @@ -25,6 +22,7 @@ using Microsoft.Scripting.Actions; using IronRuby.Runtime; using Microsoft.Scripting.Generation; +using System.Runtime.CompilerServices; namespace IronRuby.Builtins { @@ -67,23 +65,12 @@ return pairs; } - // Calls to_hash on the object, if it's not already a dictionary - // (only certain Hash functions use this in Ruby) - internal static IDictionary ConvertToHash(RubyContext/*!*/ context, object hash) { - try { - IDictionary dict = hash as IDictionary; - return dict != null ? dict : RubySites.ToHash(context, hash); - } catch (MissingMethodException e) { - throw new InvalidOperationException(String.Format("can't convert {0} into Hash", RubyUtils.GetClassName(context, hash)), e); - } - } - #endregion #region Instance Methods [RubyMethod("==")] - public static bool Equals(RubyContext/*!*/ context, IDictionary/*!*/ self, object otherHash) { + public static bool Equals(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IDictionary/*!*/ self, object otherHash) { IDictionary other = otherHash as IDictionary; if (other == null || self.Count != other.Count) { return false; @@ -92,7 +79,7 @@ // Each key value pair must be the same foreach (KeyValuePair pair in self) { object value; - if (!other.TryGetValue(pair.Key, out value) || !Protocols.IsEqual(context, pair.Value, value)) { + if (!other.TryGetValue(pair.Key, out value) || !Protocols.IsEqual(equals, context, pair.Value, value)) { return false; } } @@ -124,9 +111,13 @@ // We don't define "dup" here because "dup" shouldn't show up on builtin types like Hash // (Kernel#dup just works for these types) - private static IDictionary/*!*/ Duplicate(RubyContext/*!*/ context, IDictionary/*!*/ self) { + private static IDictionary/*!*/ Duplicate( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, IDictionary/*!*/ self) { + // Call Kernel#dup, then copy items - var copy = (IDictionary)KernelOps.Duplicate(context, self); + var copy = (IDictionary)KernelOps.Duplicate(initializeCopyStorage, allocateStorage, context, self); return ReplaceData(copy, self); } @@ -305,9 +296,9 @@ [RubyMethod("has_value?")] [RubyMethod("value?")] - public static bool HasValue(RubyContext/*!*/ context, IDictionary/*!*/ self, object value) { + public static bool HasValue(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IDictionary/*!*/ self, object value) { foreach (KeyValuePair pair in self) { - if (Protocols.IsEqual(context, pair.Value, value)) { + if (Protocols.IsEqual(equals, context, pair.Value, value)) { return true; } } @@ -315,9 +306,9 @@ } [RubyMethod("index")] - public static object Index(RubyContext/*!*/ context, IDictionary/*!*/ self, object value) { + public static object Index(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IDictionary/*!*/ self, object value) { foreach (KeyValuePair pair in self) { - if (Protocols.IsEqual(context, pair.Value, value)) { + if (Protocols.IsEqual(equals, context, pair.Value, value)) { return BaseSymbolDictionary.ObjToNull(pair.Key); } } @@ -378,24 +369,30 @@ } [RubyMethod("merge")] - public static object Merge(RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self, object otherHash) { - return Update(context, block, Duplicate(context, self), otherHash); + public static object Merge( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self, + [DefaultProtocol, NotNull]IDictionary/*!*/ hash) { + + return Update(context, block, Duplicate(initializeCopyStorage, allocateStorage, context, self), hash); } [RubyMethod("merge!")] [RubyMethod("update")] - public static object Update(RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self, object otherHash) { - IDictionary hash = ConvertToHash(context, otherHash); - if (hash != null && hash.Count > 0) { + public static object Update(RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self, + [DefaultProtocol, NotNull]IDictionary/*!*/ hash) { + + if (hash.Count > 0) { RubyUtils.RequiresNotFrozen(context, self); } if (block == null) { - foreach (KeyValuePair pair in CopyKeyValuePairs(hash)) { + foreach (var pair in CopyKeyValuePairs(hash)) { self[BaseSymbolDictionary.NullToObj(pair.Key)] = pair.Value; } } else { - foreach (KeyValuePair pair in CopyKeyValuePairs(hash)) { + foreach (var pair in CopyKeyValuePairs(hash)) { object key = pair.Key, newValue = pair.Value, oldValue; if (self.TryGetValue(key, out oldValue)) { if (block.Yield(BaseSymbolDictionary.ObjToNull(key), oldValue, pair.Value, out newValue)) { @@ -417,8 +414,12 @@ // This works like delete_if, not reject! // (because it needs to return the new collection) [RubyMethod("reject")] - public static object Reject(RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self) { - return DeleteIf(context, block, Duplicate(context, self)); + public static object Reject( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self) { + + return DeleteIf(context, block, Duplicate(initializeCopyStorage, allocateStorage, context, self)); } // This works like delete_if, but returns nil if no elements were removed @@ -450,12 +451,9 @@ } [RubyMethod("replace")] - public static IDictionary Replace(RubyContext/*!*/ context, IDictionary/*!*/ self, [NotNull]object other) { - // Do nothing if identities are the same - if (Object.ReferenceEquals(self, other)) return self; - + public static Hash/*!*/ Replace(RubyContext/*!*/ context, Hash/*!*/ self, [DefaultProtocol, NotNull]IDictionary/*!*/ other) { RubyUtils.RequiresNotFrozen(context, self); - return ReplaceData(self, ConvertToHash(context, other)); + return IDictionaryOps.ReplaceData(self, other); } [RubyMethod("select")] @@ -495,9 +493,9 @@ [RubyMethod("sort")] public static object Sort( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam block, IDictionary/*!*/ self) { return ArrayOps.SortInPlace(comparisonStorage, lessThanStorage, greaterThanStorage, context, block, ToArray(self)); } @@ -517,12 +515,12 @@ } [RubyMethod("to_s")] - public static MutableString ToString(RubyContext/*!*/ context, IDictionary/*!*/ self) { + public static MutableString ToString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, IDictionary/*!*/ self) { using (IDisposable handle = RubyUtils.InfiniteToSTracker.TrackObject(self)) { if (handle == null) { return MutableString.Create("{...}"); } else { - return IListOps.Join(context, ToArray(self)); + return IListOps.Join(tosStorage, context, ToArray(self)); } } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs;C659171 File: IListOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections; using System.Collections.Generic; @@ -58,11 +55,10 @@ return true; } - internal static bool NormalizeRange(RubyContext/*!*/ context, int listCount, Range/*!*/ range, out int begin, out int count) { - bool excludeEnd; - int end; - Protocols.ConvertToIntegerRange(context, range, out begin, out end, out excludeEnd); - + internal static bool NormalizeRange(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, int listCount, Range/*!*/ range, out int begin, out int count) { + begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); + begin = NormalizeIndex(listCount, begin); if (begin < 0 || begin > listCount) { @@ -72,7 +68,7 @@ end = NormalizeIndex(listCount, end); - count = excludeEnd ? end - begin : end - begin + 1; + count = range.ExcludeEnd ? end - begin : end - begin + 1; return true; } @@ -90,7 +86,7 @@ } } - private static IList/*!*/ GetResultRange(SiteLocalStorage>>/*!*/ allocateStorage, + private static IList/*!*/ GetResultRange(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ list, int index, int count) { IList result = CreateResultArray(allocateStorage, context, list); @@ -136,7 +132,7 @@ } } - private static IList/*!*/ CreateResultArray(SiteLocalStorage>>/*!*/ allocateStorage, + private static IList/*!*/ CreateResultArray(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ list) { // RubyArray: @@ -204,17 +200,19 @@ } [RubyMethod("*")] - public static MutableString Repetition(RubyContext/*!*/ context, IList/*!*/ self, [NotNull]MutableString/*!*/ separator) { - return Join(context, self, separator); + public static MutableString Repetition(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, + IList/*!*/ self, [NotNull]MutableString/*!*/ separator) { + return Join(tosStorage, context, self, separator); } [RubyMethod("*")] - public static object Repetition(RubyContext/*!*/ context, IList/*!*/ self, object repeat) { + public static object Repetition(ConversionStorage/*!*/ fixnumCast, UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, + IList/*!*/ self, object repeat) { MutableString str = Protocols.AsString(context, repeat); if (str != null) { - return Repetition(context, self, str); + return Repetition(tosStorage, context, self, str); } else { - return Repetition(self, Protocols.CastToFixnum(context, repeat)); + return Repetition(self, Protocols.CastToFixnum(fixnumCast, context, repeat)); } } @@ -236,12 +234,12 @@ } [RubyMethod("-")] - public static RubyArray/*!*/ Difference(RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol, NotNull]IList/*!*/ other) { + public static RubyArray/*!*/ Difference(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol, NotNull]IList/*!*/ other) { RubyArray result = new RubyArray(); // TODO: optimize this foreach (object element in self) { - if (!Include(context, other, element)) { + if (!Include(equals, context, other, element)) { result.Add(element); } } @@ -259,7 +257,7 @@ } [RubyMethod("==")] - public static bool Equals(RubyContext/*!*/ context, IList/*!*/ self, [NotNull]IList/*!*/ other) { + public static bool Equals(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, [NotNull]IList/*!*/ other) { Assert.NotNull(self, other); if (object.ReferenceEquals(self, other)) { @@ -271,7 +269,7 @@ } for (int i = 0; i < self.Count; ++i) { - bool result = Protocols.IsEqual(context, self[i], other[i]); + bool result = Protocols.IsEqual(equals, context, self[i], other[i]); if (!result) { return false; } @@ -281,11 +279,11 @@ [RubyMethod("<=>")] public static object Compare( - SiteLocalStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol, NotNull]IList/*!*/ other) { int limit = Math.Min(self.Count, other.Count); - var compare = comparisonStorage.GetCallSite("<=>", 1); + var compare = comparisonStorage.GetCallSite("<=>"); for (int i = 0; i < limit; i++) { object result = compare.Target(compare, context, self[i], other[i]); @@ -319,7 +317,7 @@ [RubyMethod("[]")] [RubyMethod("slice")] - public static IList GetElements(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList GetElements(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ list, [DefaultProtocol]int index, [DefaultProtocol]int count) { if (!NormalizeRange(list.Count, ref index, ref count)) { return null; @@ -330,10 +328,11 @@ [RubyMethod("[]")] [RubyMethod("slice")] - public static IList GetElement(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList GetElement(ConversionStorage/*!*/ fixnumCast, + CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList array, [NotNull]Range/*!*/ range) { int start, count; - if (!NormalizeRange(context, array.Count, range, out start, out count)) { + if (!NormalizeRange(fixnumCast, context, array.Count, range, out start, out count)) { return null; } @@ -436,11 +435,12 @@ } [RubyMethod("[]=")] - public static object SetElement(RubyContext/*!*/ context, IList/*!*/ self, [NotNull]Range/*!*/ range, object value) { + public static object SetElement(ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, IList/*!*/ self, [NotNull]Range/*!*/ range, object value) { RubyUtils.RequiresNotFrozen(context, self); - bool excludeEnd; - int begin, end; - Protocols.ConvertToIntegerRange(context, range, out begin, out end, out excludeEnd); + + int begin = Protocols.CastToFixnum(fixnumCast, context, range.Begin); + int end = Protocols.CastToFixnum(fixnumCast, context, range.End); begin = begin < 0 ? begin + self.Count : begin; if (begin < 0) { @@ -449,7 +449,7 @@ end = end < 0 ? end + self.Count : end; - int count = excludeEnd ? end - begin : end - begin + 1; + int count = range.ExcludeEnd ? end - begin : end - begin + 1; return SetElement(context, self, begin, Math.Max(count, 0), value); } @@ -508,11 +508,11 @@ #region assoc, rassoc - public static IList GetContainerOf(RubyContext/*!*/ context, IList list, int index, object item) { + public static IList GetContainerOf(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList list, int index, object item) { foreach (object current in list) { IList subArray = current as IList; if (subArray != null && subArray.Count > index) { - if (Protocols.IsEqual(context, subArray[index], item)) { + if (Protocols.IsEqual(equals, context, subArray[index], item)) { return subArray; } } @@ -521,13 +521,13 @@ } [RubyMethod("assoc")] - public static IList GetContainerOfFirstItem(RubyContext/*!*/ context, IList/*!*/ self, object item) { - return GetContainerOf(context, self, 0, item); + public static IList GetContainerOfFirstItem(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { + return GetContainerOf(equals, context, self, 0, item); } [RubyMethod("rassoc")] - public static IList/*!*/ GetContainerOfSecondItem(RubyContext/*!*/ context, IList/*!*/ self, object item) { - return GetContainerOf(context, self, 1, item); + public static IList/*!*/ GetContainerOfSecondItem(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { + return GetContainerOf(equals, context, self, 1, item); } #endregion @@ -559,7 +559,7 @@ } [RubyMethod("compact")] - public static IList/*!*/ Compact(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList/*!*/ Compact(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self) { IList result = CreateResultArray(allocateStorage, context, self); @@ -593,11 +593,11 @@ #region delete, delete_at - public static bool Remove(RubyContext/*!*/ context, IList/*!*/ self, object item) { + public static bool Remove(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { int i = 0; bool removed = false; while (i < self.Count) { - if (Protocols.IsEqual(context, self[i], item)) { + if (Protocols.IsEqual(equals, context, self[i], item)) { RubyUtils.RequiresNotFrozen(context, self); self.RemoveAt(i); removed = true; @@ -609,13 +609,13 @@ } [RubyMethod("delete")] - public static object Delete(RubyContext/*!*/ context, IList/*!*/ self, object item) { - return Remove(context, self, item) ? item : null; + public static object Delete(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { + return Remove(equals, context, self, item) ? item : null; } [RubyMethod("delete")] - public static object Delete(RubyContext/*!*/ context, BlockParam block, IList/*!*/ self, object item) { - bool removed = Remove(context, self, item); + public static object Delete(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, BlockParam block, IList/*!*/ self, object item) { + bool removed = Remove(equals, context, self, item); if (block != null) { object result; @@ -626,13 +626,13 @@ } [RubyMethod("delete_at")] - public static object DeleteAt(RubyContext/*!*/ context, IList/*!*/ self, object indexValue) { + public static object DeleteAt(RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol]int index) { RubyUtils.RequiresNotFrozen(context, self); - int index = Protocols.CastToFixnum(context, indexValue); index = index < 0 ? index + self.Count : index; - if (index < 0 || index > self.Count) + if (index < 0 || index > self.Count) { return null; + } object result = GetElement(self, index); self.RemoveAt(index); @@ -729,15 +729,10 @@ #region fetch [RubyMethod("fetch")] - public static object Fetch(RubyContext/*!*/ context, BlockParam outOfRangeValueProvider, IList/*!*/ list, object index, [Optional]object defaultValue) { - return Fetch(context, outOfRangeValueProvider, list, Protocols.CastToFixnum(context, index), defaultValue); - } - - [RubyMethod("fetch")] - public static object Fetch(RubyContext/*!*/ context, BlockParam outOfRangeValueProvider, IList/*!*/ list, int fixnumIndex, [Optional]object defaultValue) { - int oldIndex = fixnumIndex; - if (InRangeNormalized(list, ref fixnumIndex)) { - return list[fixnumIndex]; + public static object Fetch(RubyContext/*!*/ context, BlockParam outOfRangeValueProvider, IList/*!*/ list, [DefaultProtocol]int index, [Optional]object defaultValue) { + int oldIndex = index; + if (InRangeNormalized(list, ref index)) { + return list[index]; } if (outOfRangeValueProvider != null) { @@ -751,7 +746,7 @@ } if (defaultValue == Missing.Value) { - throw RubyExceptions.CreateIndexError("index " + fixnumIndex + " out of array"); + throw RubyExceptions.CreateIndexError("index " + index + " out of array"); } return defaultValue; } @@ -792,19 +787,19 @@ } [RubyMethod("fill")] - public static IList/*!*/ Fill(RubyContext/*!*/ context, IList/*!*/ self, object obj, object start, [DefaultParameterValue(null)]object length) { - int startFixnum = (start == null) ? 0 : Protocols.CastToFixnum(context, start); + public static IList/*!*/ Fill(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, IList/*!*/ self, object obj, object start, [DefaultParameterValue(null)]object length) { + int startFixnum = (start == null) ? 0 : Protocols.CastToFixnum(fixnumCast, context, start); if (length == null) { return Fill(context, self, obj, startFixnum); } else { - return Fill(context, self, obj, startFixnum, Protocols.CastToFixnum(context, length)); + return Fill(context, self, obj, startFixnum, Protocols.CastToFixnum(fixnumCast, context, length)); } } [RubyMethod("fill")] - public static IList/*!*/ Fill(RubyContext/*!*/ context, IList/*!*/ self, object obj, Range/*!*/ range) { - int begin = NormalizeIndex(self, Protocols.CastToFixnum(context, range.Begin)); - int end = NormalizeIndex(self, Protocols.CastToFixnum(context, range.End)); + public static IList/*!*/ Fill(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, IList/*!*/ self, object obj, Range/*!*/ range) { + int begin = NormalizeIndex(self, Protocols.CastToFixnum(fixnumCast, context, range.Begin)); + int end = NormalizeIndex(self, Protocols.CastToFixnum(fixnumCast, context, range.End)); int length = Math.Max(0, end - begin + (range.ExcludeEnd ? 0 : 1)); return Fill(context, self, obj, begin, length); @@ -846,19 +841,19 @@ } [RubyMethod("fill")] - public static object Fill(RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, IList/*!*/ self, object start, [DefaultParameterValue(null)]object length) { - int startFixnum = (start == null) ? 0 : Protocols.CastToFixnum(context, start); + public static object Fill(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, IList/*!*/ self, object start, [DefaultParameterValue(null)]object length) { + int startFixnum = (start == null) ? 0 : Protocols.CastToFixnum(fixnumCast, context, start); if (length == null) { return Fill(context, block, self, startFixnum); } else { - return Fill(context, block, self, startFixnum, Protocols.CastToFixnum(context, length)); + return Fill(context, block, self, startFixnum, Protocols.CastToFixnum(fixnumCast, context, length)); } } [RubyMethod("fill")] - public static object Fill(RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, IList/*!*/ self, Range/*!*/ range) { - int begin = NormalizeIndex(self, Protocols.CastToFixnum(context, range.Begin)); - int end = NormalizeIndex(self, Protocols.CastToFixnum(context, range.End)); + public static object Fill(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, IList/*!*/ self, Range/*!*/ range) { + int begin = NormalizeIndex(self, Protocols.CastToFixnum(fixnumCast, context, range.Begin)); + int end = NormalizeIndex(self, Protocols.CastToFixnum(fixnumCast, context, range.End)); int length = Math.Max(0, end - begin + (range.ExcludeEnd ? 0 : 1)); return Fill(context, block, self, begin, length); @@ -874,7 +869,7 @@ } [RubyMethod("first")] - public static IList/*!*/ First(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList/*!*/ First(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol]int count) { if (count < 0) { throw RubyExceptions.CreateArgumentError("negative array size (or size too big)"); @@ -890,7 +885,7 @@ } [RubyMethod("last")] - public static IList/*!*/ Last(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList/*!*/ Last(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol]int count) { if (count < 0) { throw RubyExceptions.CreateArgumentError("negative array size (or size too big)"); @@ -907,7 +902,7 @@ [MultiRuntimeAware] private static RubyUtils.RecursionTracker _infiniteFlattenTracker = new RubyUtils.RecursionTracker(); - public static bool TryFlattenArray(SiteLocalStorage>>/*!*/ flattenStorage, + public static bool TryFlattenArray(CallSiteStorage>/*!*/ flattenStorage, RubyContext/*!*/ context, IList list, out IList/*!*/ result) { // TODO: create correct subclass of RubyArray rather than RubyArray directly result = new RubyArray(); @@ -939,7 +934,7 @@ } [RubyMethod("flatten")] - public static IList/*!*/ Flatten(SiteLocalStorage>>/*!*/ flattenStorage, + public static IList/*!*/ Flatten(CallSiteStorage>/*!*/ flattenStorage, RubyContext/*!*/ context, IList/*!*/ self) { IList result; TryFlattenArray(flattenStorage, context, self, out result); @@ -947,7 +942,7 @@ } [RubyMethod("flatten!")] - public static IList FlattenInPlace(SiteLocalStorage>>/*!*/ flattenStorage, + public static IList FlattenInPlace(CallSiteStorage>/*!*/ flattenStorage, RubyContext/*!*/ context, IList/*!*/ self) { IList result; if (!TryFlattenArray(flattenStorage, context, self, out result)) { @@ -965,24 +960,26 @@ #region include?, index, rindex [RubyMethod("include?")] - public static bool Include(RubyContext/*!*/ context, IList/*!*/ self, object item) { - return Index(context, self, item) != null; + public static bool Include(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { + return Index(equals, context, self, item) != null; } [RubyMethod("index")] - public static object Index(RubyContext/*!*/ context, IList/*!*/ self, object item) { + public static object Index(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { for (int i = 0; i < self.Count; ++i) { - if (Protocols.IsEqual(context, self[i], item)) + if (Protocols.IsEqual(equals, context, self[i], item)) { return i; + } } return null; } [RubyMethod("rindex")] - public static object ReverseIndex(RubyContext/*!*/ context, IList/*!*/ self, object item) { + public static object ReverseIndex(BinaryOpStorage/*!*/ equals, RubyContext/*!*/ context, IList/*!*/ self, object item) { for (int i = self.Count - 1; i >= 0; i--) { - if (Protocols.IsEqual(context, self[i], item)) + if (Protocols.IsEqual(equals, context, self[i], item)) { return i; + } } return null; } @@ -993,7 +990,8 @@ [RubyMethod("indexes")] [RubyMethod("indices")] - public static object Indexes(SiteLocalStorage>>/*!*/ allocateStorage, + public static object Indexes(ConversionStorage/*!*/ fixnumCast, + CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [NotNull]params object[]/*!*/ values) { context.ReportWarning("Array#indexes and Array#indices are deprecated; use Array#values_at"); @@ -1002,12 +1000,12 @@ for (int i = 0; i < values.Length; ++i) { Range range = values[i] as Range; if (range != null) { - IList fragment = GetElement(allocateStorage, context, self, range); + IList fragment = GetElement(fixnumCast, allocateStorage, context, self, range); if (fragment != null) { result.Add(fragment); } } else { - result.Add(GetElement(self, Protocols.CastToFixnum(context, values[i]))); + result.Add(GetElement(self, Protocols.CastToFixnum(fixnumCast, context, values[i]))); } } @@ -1016,19 +1014,20 @@ } [RubyMethod("values_at")] - public static RubyArray/*!*/ ValuesAt(SiteLocalStorage>>/*!*/ allocateStorage, + public static RubyArray/*!*/ ValuesAt(ConversionStorage/*!*/ fixnumCast, + CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [NotNull]params object[]/*!*/ values) { RubyArray result = new RubyArray(); for (int i = 0; i < values.Length; i++) { Range range = values[i] as Range; if (range != null) { - IList fragment = GetElement(allocateStorage, context, self, range); + IList fragment = GetElement(fixnumCast, allocateStorage, context, self, range); if (fragment != null) { result.AddRange(fragment); } } else { - result.Add(GetElement(self, Protocols.CastToFixnum(context, values[i]))); + result.Add(GetElement(self, Protocols.CastToFixnum(fixnumCast, context, values[i]))); } } @@ -1039,7 +1038,9 @@ #region join, to_s, inspect - public static void RecursiveJoin(RubyContext/*!*/ context, IList/*!*/ list, MutableString/*!*/ separator, MutableString/*!*/ result, Dictionary/*!*/ seen) { + public static void RecursiveJoin(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, + IList/*!*/ list, MutableString/*!*/ separator, MutableString/*!*/ result, Dictionary/*!*/ seen) { + Assert.NotNull(list, separator, result, seen); // TODO: can we get by only tracking List<> ? // (inspect needs to track everything) @@ -1055,15 +1056,15 @@ object item = list[i]; if (item is ValueType) { - result.Append(RubySites.ToS(context, item)); + result.Append(RubyUtils.ObjectToMutableString(tosStorage, context, item)); } else if (item == null) { // append nothing } else { IList listItem = item as IList; if (listItem != null) { - RecursiveJoin(context, listItem, separator, result, seen); + RecursiveJoin(tosStorage, context, listItem, separator, result, seen); } else { - result.Append(RubySites.ToS(context, item)); + result.Append(RubyUtils.ObjectToMutableString(tosStorage, context, item)); } } @@ -1077,14 +1078,14 @@ [RubyMethod("join")] [RubyMethod("to_s")] - public static MutableString/*!*/ Join(RubyContext/*!*/ context, IList/*!*/ self) { - return Join(context, self, context.ItemSeparator); + public static MutableString/*!*/ Join(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, IList/*!*/ self) { + return Join(tosStorage, context, self, context.ItemSeparator); } [RubyMethod("join")] - public static MutableString/*!*/ Join(RubyContext/*!*/ context, IList/*!*/ self, MutableString separator) { + public static MutableString/*!*/ Join(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, IList/*!*/ self, MutableString separator) { MutableString result = MutableString.CreateMutable(); - RecursiveJoin(context, self, separator ?? MutableString.Empty, result, + RecursiveJoin(tosStorage, context, self, separator ?? MutableString.Empty, result, new Dictionary(ReferenceEqualityComparer.Instance) ); return result; @@ -1240,16 +1241,17 @@ } [RubyMethod("slice!")] - public static object SliceInPlace(SiteLocalStorage>>/*!*/ allocateStorage, + public static object SliceInPlace(ConversionStorage/*!*/ fixnumCast, + CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [NotNull]Range/*!*/ range) { RubyUtils.RequiresNotFrozen(context, self); - object result = GetElement(allocateStorage, context, self, range); - SetElement(context, self, range, null); + object result = GetElement(fixnumCast, allocateStorage, context, self, range); + SetElement(fixnumCast, context, self, range, null); return result; } [RubyMethod("slice!")] - public static IList/*!*/ SliceInPlace(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList/*!*/ SliceInPlace(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self, [DefaultProtocol]int start, [DefaultProtocol]int length) { RubyUtils.RequiresNotFrozen(context, self); IList result = GetElements(allocateStorage, context, self, start, length); @@ -1263,10 +1265,10 @@ [RubyMethod("sort")] public static IList/*!*/ Sort( - SiteLocalStorage>>/*!*/ allocateStorage, - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + CallSiteStorage>/*!*/ allocateStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam block, IList/*!*/ self) { // TODO: this is not optimal because it makes an extra array copy @@ -1278,9 +1280,9 @@ [RubyMethod("sort!")] public static IList/*!*/ SortInPlace( - SiteLocalStorage/*!*/ comparisonStorage, - SiteLocalStorage/*!*/ lessThanStorage, - SiteLocalStorage/*!*/ greaterThanStorage, + BinaryOpStorage/*!*/ comparisonStorage, + BinaryOpStorage/*!*/ lessThanStorage, + BinaryOpStorage/*!*/ greaterThanStorage, RubyContext/*!*/ context, BlockParam block, IList/*!*/ self) { RubyUtils.RequiresNotFrozen(context, self); @@ -1350,7 +1352,7 @@ } [RubyMethod("uniq")] - public static IList/*!*/ Unique(SiteLocalStorage>>/*!*/ allocateStorage, + public static IList/*!*/ Unique(CallSiteStorage>/*!*/ allocateStorage, RubyContext/*!*/ context, IList/*!*/ self) { IList result = CreateResultArray(allocateStorage, context, self); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/BasicSocket.cs;C633889 File: BasicSocket.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/BasicSocket.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/BasicSocket.cs;MoreSites4 @@ -27,6 +27,7 @@ using IronRuby.Builtins; using IronRuby.Runtime; using IronRuby.StandardLibrary.FileControl; +using Microsoft.Scripting.Math; namespace IronRuby.StandardLibrary.Sockets { [RubyClass("BasicSocket", BuildConfig = "!SILVERLIGHT")] @@ -141,21 +142,7 @@ } [RubyMethod("shutdown")] - public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self) { - return Shutdown(context, self, 2); - } - - [RubyMethod("shutdown")] - public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ how) { - int iHow = 2; - if (how != null) { - iHow = Protocols.CastToFixnum(context, how); - } - return Shutdown(context, self, iHow); - } - - [RubyMethod("shutdown")] - public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, int how) { + public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, DefaultParameterValue(2)]int how) { CheckSecurity(context, self, "can't shutdown socket"); if (how < 0 || 2 < how) { throw RubyExceptions.CreateArgumentError("`how' should be either 0, 1, 2"); @@ -171,11 +158,11 @@ /// optname is an integer, usually one of the SO_ constants, such as Socket::SO_REUSEADDR. /// value is the value of the option, it is passed to the underlying setsockopt() as a pointer to a certain number of bytes. How this is done depends on the type. [RubyMethod("setsockopt")] - public static void SetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname, int value) { + public static void SetSocketOption(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, + RubyBasicSocket/*!*/ self, [DefaultProtocol]int level, [DefaultProtocol]int optname, int value) { + Protocols.CheckSafeLevel(context, 2, "setsockopt"); - int iLevel = Protocols.CastToFixnum(context, level); - int iOptname = Protocols.CastToFixnum(context, optname); - self.Socket.SetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, value); + self.Socket.SetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, value); } /// @@ -185,11 +172,11 @@ /// optname is an integer, usually one of the SO_ constants, such as Socket::SO_REUSEADDR. /// value is the value of the option, it is passed to the underlying setsockopt() as a pointer to a certain number of bytes. How this is done depends on the type. [RubyMethod("setsockopt")] - public static void SetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname, bool value) { + public static void SetSocketOption(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, + RubyBasicSocket/*!*/ self, [DefaultProtocol]int level, [DefaultProtocol]int optname, bool value) { + Protocols.CheckSafeLevel(context, 2, "setsockopt"); - int iLevel = Protocols.CastToFixnum(context, level); - int iOptname = Protocols.CastToFixnum(context, optname); - self.Socket.SetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, value); + self.Socket.SetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, value); } /// @@ -217,12 +204,11 @@ /// sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, optval) /// [RubyMethod("setsockopt")] - public static void SetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname, object value) { + public static void SetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, + [DefaultProtocol]int level, [DefaultProtocol]int optname, [DefaultProtocol, NotNull]MutableString/*!*/ value) { + Protocols.CheckSafeLevel(context, 2, "setsockopt"); - MutableString strValue = Protocols.CastToString(context, value); - int iLevel = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, level)); - int iOptname = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, optname)); - self.Socket.SetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, strValue.ConvertToBytes()); + self.Socket.SetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, value.ConvertToBytes()); } /// @@ -249,11 +235,10 @@ /// onoff, linger = optval.unpack "ii" /// [RubyMethod("getsockopt")] - public static MutableString GetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname) { + public static MutableString GetSocketOption(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, + RubyBasicSocket/*!*/ self, [DefaultProtocol]int level, [DefaultProtocol]int optname) { Protocols.CheckSafeLevel(context, 2, "getsockopt"); - int iLevel = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, level)); - int iOptname = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, optname)); - byte[] value = self.Socket.GetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, 4); + byte[] value = self.Socket.GetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, 4); return MutableString.CreateBinary(value); } @@ -278,34 +263,33 @@ } [RubyMethod("send")] - public static int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags) { + public static int Send(ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message, object flags) { Protocols.CheckSafeLevel(context, 4, "send"); - SocketFlags socketFlags = ConvertToSocketFlag(context, flags); - MutableString strMessage = Protocols.CastToString(context, message); - return self.Socket.Send(strMessage.ConvertToBytes(), socketFlags); + SocketFlags socketFlags = ConvertToSocketFlag(fixnumCast, context, flags); + return self.Socket.Send(message.ConvertToBytes(), socketFlags); } [RubyMethod("send")] - public static int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags, object to) { + public static int Send(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, + [DefaultProtocol, NotNull]MutableString/*!*/ message, object flags, [DefaultProtocol, NotNull]MutableString/*!*/ to) { Protocols.CheckSafeLevel(context, 4, "send"); // Convert the parameters - SocketFlags socketFlags = ConvertToSocketFlag(context, flags); - MutableString strMessage = Protocols.CastToString(context, message); - MutableString strToAddress = Protocols.CastToString(context, to); + SocketFlags socketFlags = ConvertToSocketFlag(fixnumCast, context, flags); // Unpack the socket address information from the to parameter SocketAddress address = new SocketAddress(AddressFamily.InterNetwork); - for (int i = 0; i < strToAddress.GetByteCount(); i++) { - address[i] = strToAddress.GetByte(i); + for (int i = 0; i < to.GetByteCount(); i++) { + address[i] = to.GetByte(i); } EndPoint toEndPoint = self.Socket.LocalEndPoint.Create(address); - return self.Socket.SendTo(strMessage.ConvertToBytes(), socketFlags, toEndPoint); + return self.Socket.SendTo(message.ConvertToBytes(), socketFlags, toEndPoint); } [RubyMethod("recv")] - public static MutableString Receive(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, + public static MutableString Receive(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol]int length, [DefaultParameterValue(null)]object flags) { - SocketFlags sFlags = ConvertToSocketFlag(context, flags); + SocketFlags sFlags = ConvertToSocketFlag(fixnumCast, context, flags); byte[] buffer = new byte[length]; int received = self.Socket.Receive(buffer, 0, length, sFlags); @@ -332,13 +316,13 @@ /// p s.recv_nonblock(10) #=> "aaa" /// [RubyMethod("recv_nonblock")] - public static MutableString/*!*/ ReceiveNonBlocking(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, + public static MutableString/*!*/ ReceiveNonBlocking(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol]int length, [DefaultParameterValue(null)]object flags) { bool blocking = self.Socket.Blocking; try { self.Socket.Blocking = false; - return Receive(context, self, length, flags); + return Receive(fixnumCast, context, self, length, flags); } finally { // Reset the blocking self.Socket.Blocking = blocking; @@ -407,14 +391,16 @@ } } - internal static SocketFlags ConvertToSocketFlag(RubyContext/*!*/ context, object flags) { + internal static SocketFlags ConvertToSocketFlag(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, object flags) { if (flags == null) { return SocketFlags.None; } - return (SocketFlags)Protocols.CastToFixnum(context, flags); + return (SocketFlags)Protocols.CastToFixnum(conversionStorage, context, flags); } - internal static AddressFamily ConvertToAddressFamily(RubyContext/*!*/ context, object family) { + internal static AddressFamily ConvertToAddressFamily(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, object family) { + // Default is AF_INET if (family == null) { return AddressFamily.InterNetwork; @@ -424,14 +410,14 @@ return (AddressFamily)(int)family; } // Convert to a string (using to_str) and then look up the value - MutableString strFamily = Protocols.CastToString(context, family); + MutableString strFamily = Protocols.CastToString(stringCast, context, family); foreach (AddressFamilyName name in FamilyNames) { if (name.Name.Equals(strFamily)) { return name.Family; } } // Convert to a Fixnum (using to_i) and hope it is a valid AddressFamily constant - return (AddressFamily)Protocols.CastToFixnum(context, strFamily); + return (AddressFamily)Protocols.CastToFixnum(fixnumCast, context, strFamily); } internal static MutableString ToAddressFamilyString(AddressFamily family) { @@ -459,7 +445,7 @@ return strHostname; } int iHostname; - if (Protocols.IntegerAsFixnum(hostname, out iHostname)) { + if (IntegerAsFixnum(hostname, out iHostname)) { // Ruby uses Little Endian whereas .NET uses Big Endian IP values byte[] bytes = new byte[4]; for (int i = 3; i >= 0; --i) { @@ -471,22 +457,47 @@ return Protocols.CastToString(context, hostname); } - internal static int ConvertToPortNum(RubyContext/*!*/ context, object port) { + /// + /// Converts an Integer to a Fixnum. + /// Don't call any conversion methods--just handles Fixnum & Bignum + /// + /// + /// true if value is an Integer, false otherwise + /// Throws a RangeError if value is a + /// BigInteger but can't be converted to a Fixnum + internal static bool IntegerAsFixnum(object value, out int result) { + if (value is int) { + result = (int)value; + return true; + } + + var bignum = value as BigInteger; + if ((object)bignum != null) { + if (!bignum.AsInt32(out result)) { + throw RubyExceptions.CreateRangeError("bignum too big to convert into `long'"); + } + return true; + } + + result = 0; + return false; + } + + internal static int ConvertToPortNum(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, object port) { // conversion protocol: if it's a Fixnum, return it // otherwise, convert to string & then convert the result to a Fixnum if (port is int) { return (int)port; } - MutableString serviceName = Protocols.CastToString(context, port); + MutableString serviceName = Protocols.CastToString(stringCast, context, port); ServiceName service = SearchForService(serviceName); if (service != null) { return service.Port; } - int result; - Protocols.IntegerAsFixnum(Protocols.ConvertToInteger(context, serviceName), out result); - return result; + return Protocols.CastToFixnum(fixnumCast, context, serviceName); } internal static ServiceName SearchForService(int port) { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/IPSocket.cs;C633889 File: IPSocket.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/IPSocket.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/IPSocket.cs;MoreSites4 @@ -20,6 +20,7 @@ using Microsoft.Scripting.Runtime; using IronRuby.Builtins; using IronRuby.Runtime; +using System.Runtime.InteropServices; namespace IronRuby.StandardLibrary.Sockets { [RubyClass("IPSocket", BuildConfig = "!SILVERLIGHT")] @@ -35,6 +36,7 @@ } #region Public Instance Methods + [RubyMethod("addr")] public static RubyArray/*!*/ GetLocalAddress(RubyContext/*!*/ context, IPSocket/*!*/ self) { return GetAddressArray(context, self.Socket.LocalEndPoint); @@ -46,12 +48,10 @@ } [RubyMethod("recvfrom")] - public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, IPSocket/*!*/ self, int length) { - return ReceiveFrom(context, self, length, null); - } - [RubyMethod("recvfrom")] - public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) { - SocketFlags sFlags = ConvertToSocketFlag(context, flags); + public static RubyArray/*!*/ ReceiveFrom(ConversionStorage/*!*/ conversionStorage, RubyContext/*!*/ context, IPSocket/*!*/ self, + int length, [DefaultParameterValue(null)]object/*Numeric*/ flags) { + + SocketFlags sFlags = ConvertToSocketFlag(conversionStorage, context, flags); byte[] buffer = new byte[length]; EndPoint fromEP = new IPEndPoint(IPAddress.Any, 0); int received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/Socket.cs;C667392 File: Socket.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/Socket.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/Socket.cs;MoreSites4 @@ -25,6 +25,7 @@ using IronRuby.Builtins; using IronRuby.Compiler; using IronRuby.Runtime; +using System.IO; namespace IronRuby.StandardLibrary.Sockets { [RubyClass("Socket", BuildConfig = "!SILVERLIGHT")] @@ -37,8 +38,10 @@ } [RubyConstructor] - public static RubySocket/*!*/ CreateSocket(RubyClass/*!*/ self, [NotNull]object/*!*/ domain, [DefaultProtocol]int/*!*/ type, [DefaultProtocol]int protocol) { - AddressFamily addressFamily = ConvertToAddressFamily(self.Context, domain); + public static RubySocket/*!*/ CreateSocket(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, [NotNull]object/*!*/ domain, [DefaultProtocol]int/*!*/ type, [DefaultProtocol]int protocol) { + + AddressFamily addressFamily = ConvertToAddressFamily(stringCast, fixnumCast, self.Context, domain); return new RubySocket(self.Context, new Socket(addressFamily, (SocketType)type, (ProtocolType)protocol)); } @@ -47,20 +50,22 @@ #region Public Singleton Methods [RubyMethod("getaddrinfo", RubyMethodAttributes.PublicSingleton)] - public static RubyArray GetAddressInfo(RubyContext/*!*/ context, RubyClass/*!*/ self, object hostname, object port, + public static RubyArray GetAddressInfo( + ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, RubyClass/*!*/ self, object hostname, object port, [DefaultParameterValue(null)]object family, [DefaultParameterValue(0)]object socktype, [DefaultParameterValue(0)]object protocol, [DefaultParameterValue(null)]object flags) { MutableString strHostname = ConvertToHostString(context, hostname); - int iPort = ConvertToPortNum(context, port); + int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port); // Sadly the family, socktype, protocol and flags get passed through at best and ignored at worst, // since System.Net does not provide for them - AddressFamily addrFamily = ConvertToAddressFamily(context, family); - int socketType = Protocols.CastToFixnum(context, socktype); - int protocolType = Protocols.CastToFixnum(context, protocol); + AddressFamily addrFamily = ConvertToAddressFamily(stringCast, fixnumCast, context, family); + int socketType = Protocols.CastToFixnum(fixnumCast, context, socktype); + int protocolType = Protocols.CastToFixnum(fixnumCast, context, protocol); RubyArray results = new RubyArray(); @@ -116,10 +121,10 @@ } [RubyMethod("gethostbyaddr", RubyMethodAttributes.PublicSingleton)] - public static RubyArray GetHostByAddress(RubyClass/*!*/ self, - [DefaultProtocol, NotNull]MutableString/*!*/ address, [DefaultParameterValue(null)]object type) { + public static RubyArray GetHostByAddress(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ address, [DefaultParameterValue(null)]object type) { - AddressFamily addressFamily = ConvertToAddressFamily(self.Context, type); + AddressFamily addressFamily = ConvertToAddressFamily(stringCast, fixnumCast, self.Context, type); IPHostEntry entry = GetHostEntry(new IPAddress(address.ConvertToBytes())); return CreateHostEntryArray(entry, true); @@ -173,19 +178,20 @@ } [RubyMethod("getnameinfo", RubyMethodAttributes.PublicSingleton)] - public static RubyArray/*!*/ GetNameInfo(RubyClass/*!*/ self, [NotNull]RubyArray/*!*/ hostInfo, [Optional]object flags) { + public static RubyArray/*!*/ GetNameInfo(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, [NotNull]RubyArray/*!*/ hostInfo, [Optional]object flags) { if (hostInfo.Count < 3 || hostInfo.Count > 4) { throw RubyExceptions.CreateArgumentError("First parameter must be a 3 or 4 element array"); } // We only support AF_INET (IP V4) family - AddressFamily addressFamily = ConvertToAddressFamily(self.Context, hostInfo[0]); + AddressFamily addressFamily = ConvertToAddressFamily(stringCast, fixnumCast, self.Context, hostInfo[0]); if (addressFamily != AddressFamily.InterNetwork) { throw new SocketException((int)SocketError.AddressFamilyNotSupported); } // Lookup the service name for the given port. - int port = ConvertToPortNum(self.Context, hostInfo[1]); + int port = ConvertToPortNum(stringCast, fixnumCast, self.Context, hostInfo[1]); ServiceName service = SearchForService(port); // hostInfo[2] should have a host name @@ -231,9 +237,11 @@ /// [RubyMethod("sockaddr_in", RubyMethodAttributes.PublicSingleton)] [RubyMethod("pack_sockaddr_in", RubyMethodAttributes.PublicSingleton)] - public static MutableString/*!*/ PackInetSockAddr(RubyClass/*!*/ self, object port, object host) { - int iPort = ConvertToPortNum(self.Context, port); + public static MutableString/*!*/ PackInetSockAddr(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, object port, object host) { + int iPort = ConvertToPortNum(stringCast, fixnumCast, self.Context, port); MutableString strHost = ConvertToHostString(self.Context, host); + IPEndPoint ep; IPAddress[] addresses = Dns.GetHostAddresses(strHost.ConvertToString()); if (addresses.Length > 0) { @@ -327,13 +335,14 @@ } [RubyMethod("recvfrom")] - public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, RubySocket/*!*/ self, int length) { - return ReceiveFrom(context, self, length, null); + public static RubyArray/*!*/ ReceiveFrom(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, RubySocket/*!*/ self, int length) { + return ReceiveFrom(fixnumCast, context, self, length, null); } [RubyMethod("recvfrom")] - public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, RubySocket/*!*/ self, int length, object/*Numeric*/ flags) { - SocketFlags sFlags = ConvertToSocketFlag(context, flags); + public static RubyArray/*!*/ ReceiveFrom(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, RubySocket/*!*/ self, + int length, object/*Numeric*/ flags) { + SocketFlags sFlags = ConvertToSocketFlag(fixnumCast, context, flags); byte[] buffer = new byte[length]; EndPoint fromEP = new IPEndPoint(IPAddress.Any, 0); int received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP); @@ -934,8 +943,8 @@ str = str.Remove(0, 1); } - Tokenizer tokenizer = new Tokenizer(false, ErrorSink.Null); - tokenizer.Initialize(context.CreateSnippet(str, SourceCodeKind.File)); + Tokenizer tokenizer = new Tokenizer(); + tokenizer.Initialize(new StringReader(str)); Tokens token = tokenizer.GetNextToken(); TokenValue value = tokenizer.TokenValue; Tokens nextToken = tokenizer.GetNextToken(); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPServer.cs;C633889 File: TCPServer.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPServer.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPServer.cs;MoreSites4 @@ -64,8 +64,8 @@ } [RubyConstructor] - public static TCPServer/*!*/ CreateTCPServer(RubyClass/*!*/ self, - [DefaultProtocol]MutableString hostname, [DefaultParameterValue(null)]object port) { + public static TCPServer/*!*/ CreateTCPServer(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, [DefaultProtocol]MutableString hostname, [DefaultParameterValue(null)]object port) { IPAddress listeningInterface = null; if (hostname == null) { @@ -96,7 +96,7 @@ } Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - socket.Bind(new IPEndPoint(listeningInterface, ConvertToPortNum(self.Context, port))); + socket.Bind(new IPEndPoint(listeningInterface, ConvertToPortNum(stringCast, fixnumCast, self.Context, port))); socket.Listen(10); return new TCPServer(self.Context, socket); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPSocket.cs;C633889 File: TCPSocket.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPSocket.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/TCPSocket.cs;MoreSites4 @@ -33,8 +33,9 @@ } [RubyConstructor] - public static TCPSocket/*!*/ CreateTCPSocket(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ remoteHost, object remotePort) { - int port = ConvertToPortNum(self.Context, remotePort); + public static TCPSocket/*!*/ CreateTCPSocket(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ remoteHost, object remotePort) { + int port = ConvertToPortNum(stringCast, fixnumCast, self.Context, remotePort); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(remoteHost.ConvertToString(), port); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/UDPSocket.cs;C633889 File: UDPSocket.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/UDPSocket.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/UDPSocket.cs;MoreSites4 @@ -35,8 +35,9 @@ } [RubyConstructor] - public static UDPSocket/*!*/ CreateUDPSocket(RubyClass/*!*/ self, object family) { - AddressFamily addressFamily = ConvertToAddressFamily(self.Context, family); + public static UDPSocket/*!*/ CreateUDPSocket(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyClass/*!*/ self, object family) { + AddressFamily addressFamily = ConvertToAddressFamily(stringCast, fixnumCast, self.Context, family); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); return new UDPSocket(self.Context, socket); } @@ -44,8 +45,10 @@ #region Public Instance Methods [RubyMethod("bind")] - public static int Bind(RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) { - int iPort = ConvertToPortNum(context, port); + public static int Bind(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) { + + int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port); if (hostname == null) { hostname = MutableString.Create("localhost"); } @@ -56,19 +59,21 @@ } [RubyMethod("connect")] - public static int Connect(RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) { + public static int Connect(ConversionStorage/*!*/ stringCast, ConversionStorage/*!*/ fixnumCast, + RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) { + MutableString strHostname = ConvertToHostString(context, hostname); - int iPort = ConvertToPortNum(context, port); + int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port); self.Socket.Connect(strHostname.ConvertToString(), iPort); return 0; } [RubyMethod("recvfrom_nonblock")] - public static RubyArray/*!*/ ReceiveFromNonBlocking(RubyContext/*!*/ context, IPSocket/*!*/ self, int length) { + public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, IPSocket/*!*/ self, int length) { bool blocking = self.Socket.Blocking; try { self.Socket.Blocking = false; - return ReceiveFrom(context, self, length, null); + return ReceiveFrom(fixnumCast, context, self, length, null); } finally { // Reset the blocking self.Socket.Blocking = blocking; @@ -76,11 +81,11 @@ } [RubyMethod("recvfrom_nonblock")] - public static RubyArray/*!*/ ReceiveFromNonBlocking(RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) { + public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) { bool blocking = self.Socket.Blocking; try { self.Socket.Blocking = false; - return ReceiveFrom(context, self, length, flags); + return ReceiveFrom(fixnumCast, context, self, length, flags); } finally { // Reset the blocking self.Socket.Blocking = blocking; @@ -88,26 +93,33 @@ } [RubyMethod("send")] - public static int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags, object hostname, object port) { + public static int Send(ConversionStorage/*!*/ fixnumCast, ConversionStorage/*!*/ stringCast, + RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message, + object flags, object hostname, object port) { + Protocols.CheckSafeLevel(context, 4, "send"); + int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port); + SocketFlags sFlags = ConvertToSocketFlag(fixnumCast, context, flags); + // Convert the parameters - SocketFlags sFlags = ConvertToSocketFlag(context, flags); - MutableString strMessage = Protocols.CastToString(context, message); MutableString address = GetAddressInternal(context, hostname); - int iPort = ConvertToPortNum(context, port); EndPoint toEndPoint = new IPEndPoint(IPAddress.Parse(address.ConvertToString()), iPort); - return self.Socket.SendTo(strMessage.ConvertToBytes(), sFlags, toEndPoint); + return self.Socket.SendTo(message.ConvertToBytes(), sFlags, toEndPoint); } // These overwritten methods have to be here because we kill the ones in RubyBasicSocket by creating the one above [RubyMethod("send")] - public static new int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags) { - return RubyBasicSocket.Send(context, self, message, flags); + public static new int Send(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, + RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message, object flags) { + return RubyBasicSocket.Send(fixnumCast, context, self, message, flags); } [RubyMethod("send")] - public static new int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags, object to) { - return RubyBasicSocket.Send(context, self, message, flags, to); + public static new int Send(ConversionStorage/*!*/ fixnumCast, RubyContext/*!*/ context, + RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message, object flags, + [DefaultProtocol, NotNull]MutableString/*!*/ to) { + + return RubyBasicSocket.Send(fixnumCast, context, self, message, flags, to); } #endregion =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs;C659171 File: zlib.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs;MoreSites4 @@ -13,9 +13,6 @@ * * ***************************************************************************/ -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - using System; using System.Collections.Generic; using System.IO; @@ -511,11 +508,16 @@ } [RubyMethod("inflate", RubyMethodAttributes.PublicSingleton)] - public static MutableString InflateStream(SiteLocalStorage>>/*!*/ storage, + public static MutableString InflateStream( + CallSiteStorage>/*!*/ allocateStorage, + CallSiteStorage>/*!*/ inflateStorage, RubyClass/*!*/ self, MutableString zstring) { - object obj = RubySites.Allocate(self); - var site = storage.GetCallSite("inflate", 1); - return site.Target(site, self.Context, obj, zstring); + + var allocateSite = allocateStorage.GetCallSite("allocate", 0); + object obj = allocateSite.Target(allocateSite, self.Context, self); + + var inflateSite = inflateStorage.GetCallSite("inflate", 1); + return inflateSite.Target(inflateSite, self.Context, obj, zstring); } internal class HuffmanTree { @@ -617,7 +619,7 @@ } [RubyConstructor] - public static GZipReader/*!*/ Create(SiteLocalStorage/*!*/ respondToStorage, RubyClass/*!*/ self, object io) { + public static GZipReader/*!*/ Create(RespondToStorage/*!*/ respondToStorage, RubyClass/*!*/ self, object io) { Stream stream = null; if (io != null) { stream = RubyIOOps.CreateIOWrapper(respondToStorage, self.Context, io, FileAccess.Read); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Ruby.csproj;C670119 File: Ruby.csproj =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Ruby.csproj;C670119 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Ruby.csproj;MoreSites4 @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.30703 + 9.0.30729 2.0 {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD} Library @@ -151,6 +151,7 @@ + @@ -359,5 +360,5 @@ - + \ No newline at end of file =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/Range.cs;C659171 File: Range.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/Range.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/Range.cs;MoreSites4 @@ -22,9 +22,6 @@ using System.Runtime.CompilerServices; using IronRuby.Runtime.Calls; -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - namespace IronRuby.Builtins { public partial class Range : IDuplicable @@ -81,12 +78,12 @@ } // Convience function for constructing from C#, calls initialize - public Range(SiteLocalStorage/*!*/ comparisonStorage, + public Range(BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, object begin, object end, bool excludeEnd) { Initialize(comparisonStorage, context, begin, end, excludeEnd); } - public void Initialize(SiteLocalStorage/*!*/ comparisonStorage, + public void Initialize(BinaryOpStorage/*!*/ comparisonStorage, RubyContext/*!*/ context, object begin, object end, bool excludeEnd) { if (_initialized) { @@ -97,7 +94,7 @@ // Only a non-existent <=> method or a result of nil seems to trigger the exception. object compareResult; - var site = comparisonStorage.GetCallSite("<=>", 1); + var site = comparisonStorage.GetCallSite("<=>"); try { compareResult = site.Target(site, context, begin, end); } catch (Exception) { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubySites.cs;C659171 File: RubySites.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubySites.cs;C659171 (server) 12/9/2008 1:59 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubySites.cs;MoreSites4 @@ -23,10 +23,7 @@ namespace IronRuby.Builtins { - // TODO: Many of these methods have strongly typed results (int, bool, etc). - // While this is nice for using them in C#, it is incorrect, because the - // method could return an arbitrary object. Currently the binder will - // generate calls into Converter, which will not have the right behavior. + // TODO: remove public static class RubySites { private static readonly CallSite> InspectSharedSite = CallSite>.Create(InstanceCallAction("inspect")); @@ -35,27 +32,6 @@ return InspectSharedSite.Target(InspectSharedSite, context, obj); } - private static readonly CallSite> AllocateSharedSite = - CallSite>.Create(InstanceCallAction("allocate")); - - public static object Allocate(RubyClass/*!*/ classObj) { - return AllocateSharedSite.Target(AllocateSharedSite, classObj.Context, classObj); - } - - private static readonly CallSite> CaseEqualSharedSite = - CallSite>.Create(InstanceCallAction("===", 1)); - - public static bool CaseEqual(RubyContext/*!*/ context, object lhs, object rhs) { - return RubyOps.IsTrue(CaseEqualSharedSite.Target(CaseEqualSharedSite, context, lhs, rhs)); - } - - private static readonly CallSite> EqualSharedSite = - CallSite>.Create(InstanceCallAction("==", 1)); - - public static bool Equal(RubyContext/*!*/ context, object lhs, object rhs) { - return RubyOps.IsTrue(EqualSharedSite.Target(EqualSharedSite, context, lhs, rhs)); - } - private static readonly CallSite> RespondToSharedSite = CallSite>.Create(InstanceCallAction("respond_to?", 1)); @@ -63,41 +39,6 @@ return RubyOps.IsTrue(RespondToSharedSite.Target(RespondToSharedSite, context, obj, SymbolTable.StringToId(name))); } - private static readonly CallSite> _ToISharedSite = - CallSite>.Create(InstanceCallAction("to_i")); - - public static object ToI(RubyContext/*!*/ context, object value) { - return _ToISharedSite.Target(_ToISharedSite, context, value); - } - - private static readonly CallSite> _ToIntSharedSite = CallSite>.Create( - InstanceCallAction("to_int")); - - public static object ToInt(RubyContext/*!*/ context, object value) { - return _ToIntSharedSite.Target(_ToIntSharedSite, context, value); - } - - private static readonly CallSite> _ToFSharedSite = CallSite>.Create( - InstanceCallAction("to_f")); - - public static double ToF(RubyContext/*!*/ context, object value) { - return _ToFSharedSite.Target(_ToFSharedSite, context, value); - } - - private static readonly CallSite> ToStrSharedSite = CallSite>.Create( - InstanceCallAction("to_str")); - - public static MutableString ToStr(RubyContext/*!*/ context, object value) { - return ToStrSharedSite.Target(ToStrSharedSite, context, value); - } - - private static readonly CallSite> ToRangeSharedSite = CallSite>.Create( - InstanceCallAction("to_range")); - - public static Range ToRange(RubyContext/*!*/ context, object value) { - return ToRangeSharedSite.Target(ToRangeSharedSite, context, value); - } - private static readonly CallSite> ToSSharedSite = CallSite>.Create( InstanceCallAction("to_s")); @@ -105,27 +46,6 @@ return ToSSharedSite.Target(ToSSharedSite, context, value); } - private static readonly CallSite> RangeBeginSharedSite = CallSite>.Create( - InstanceCallAction("begin")); - - public static object RangeBegin(RubyContext/*!*/ context, Range range) { - return RangeBeginSharedSite.Target(RangeBeginSharedSite, context, range); - } - - private static readonly CallSite> RangeEndSharedSite = CallSite>.Create( - InstanceCallAction("end")); - - public static object RangeEnd(RubyContext/*!*/ context, Range range) { - return RangeEndSharedSite.Target(RangeEndSharedSite, context, range); - } - - private static readonly CallSite> RangeExcludeEndSharedSite = CallSite>.Create( - InstanceCallAction("exclude_end?")); - - public static bool RangeExcludeEnd(RubyContext/*!*/ context, Range range) { - return RangeExcludeEndSharedSite.Target(RangeExcludeEndSharedSite, context, range); - } - private static readonly CallSite> ModuleConstMissingSharedSite = CallSite>.Create( InstanceCallAction("const_missing", 1)); @@ -133,20 +53,6 @@ return ModuleConstMissingSharedSite.Target(ModuleConstMissingSharedSite, context, self, SymbolTable.StringToId(name)); } - private static readonly CallSite>> _ToHashSharedSite = CallSite>>.Create( - InstanceCallAction("to_hash")); - - public static IDictionary ToHash(RubyContext/*!*/ context, object obj) { - return _ToHashSharedSite.Target(_ToHashSharedSite, context, obj); - } - - private static readonly CallSite> _EachSharedSite = CallSite>.Create( - InstanceCallAction("each", RubyCallSignature.WithBlock(0))); - - public static object Each(RubyContext/*!*/ context, object self, Proc block) { - return _EachSharedSite.Target(_EachSharedSite, context, self, block); - } - #region Helpers public static RubyCallAction InstanceCallAction(string/*!*/ name) { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/ReflectionCache.Generated.cs;C672727 File: ReflectionCache.Generated.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/ReflectionCache.Generated.cs;C672727 (server) 12/9/2008 5:36 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/ReflectionCache.Generated.cs;MoreSites4 @@ -19,40 +19,18 @@ namespace IronRuby.Compiler { internal static partial class Methods { - private static MethodInfo _CreateExclusiveRange, _CreateInclusiveIntegerRange, _CreateExclusiveIntegerRange, _AllocateStructInstance, _CreateStructInstance, _GetMetaObject, _ToProcValidator, _ToStringValidator, _ToSValidator, _ToSymbolValidator, _ConvertSymbolIdToSymbol, _ConvertFixnumToSymbol, _ConvertMutableStringToSymbol, _ToRegexValidator, _ToArrayValidator, _ToFixnumValidator, _CreateTypeConversionError, _ConvertBignumToFixnum, _GetInstanceVariable, - _IsDefinedInstanceVariable, _SetInstanceVariable, _GetObjectClassVariable, _GetClassVariable, _TryGetObjectClassVariable, _TryGetClassVariable, _IsDefinedObjectClassVariable, _IsDefinedClassVariable, _SetObjectClassVariable, _SetClassVariable, _GetInstanceData, _DeserializeObject, _SerializeObject, _HookupEvent, _CreateDelegateFromProc, _CreateDelegateFromMethod, _X, _IsDefinedUnqualifiedConstant, _IsDefinedQualifiedConstant, _SetGlobalConstant, - _SetUnqualifiedConstant, _SetQualifiedConstant, _MakeArray0, _MakeArray1, _MakeArray2, _MakeArray3, _MakeArray4, _MakeArray5, _MakeArrayN, _MakeHash0, _MakeHash, _SplatAppend, _Splat, _SplatPair, _Unsplat, _GetArrayItem, _GetArraySuffix, _GetGlobalVariable, _IsDefinedGlobalVariable, _SetGlobalVariable, - _AliasGlobalVariable, _GetCurrentMatchGroup, _GetCurrentMatchData, _GetCurrentMatchLastGroup, _GetCurrentMatchPrefix, _GetCurrentMatchSuffix, _MatchLastInputLine, _MatchString, _CreateRegexB, _CreateRegexU, _CreateRegexE, _CreateRegexM, _CreateRegexBM, _CreateRegexUM, _CreateRegexEM, _CreateRegexMB, _CreateRegexMU, _CreateRegexME, _CreateRegexMM, _CreateRegexN, - _CreateMutableStringB, _CreateMutableStringU, _CreateMutableStringE, _CreateMutableStringM, _CreateMutableStringBM, _CreateMutableStringUM, _CreateMutableStringEM, _CreateMutableStringMB, _CreateMutableStringMU, _CreateMutableStringME, _CreateMutableStringMM, _CreateMutableStringN, _CreateSymbolB, _CreateSymbolU, _CreateSymbolE, _CreateSymbolM, _CreateSymbolBM, _CreateSymbolUM, _CreateSymbolEM, _CreateSymbolMB, - _CreateSymbolMU, _CreateSymbolME, _CreateSymbolMM, _CreateSymbolN, _CreateEncoding, _IsTrue, _IsFalse, _GetCurrentException, _SetCurrentExceptionAndStackTrace, _SetCurrentException, _CompareException, _CompareSplattedExceptions, _CompareDefaultException, _GetDefaultExceptionMessage, _MakeWrongNumberOfArgumentsError, _MakeTopLevelSuperException, _MakeMissingSuperException, _MakeInvalidArgumentTypesError, _MakeAmbiguousMatchError, _IsSuperCallTarget, - _CreateInclusiveRange, _UpdateProfileTicks, _IsProcConverterTarget, _CreateBfcForYield, _CreateBfcForMethodProcCall, _CreateBfcForProcCall, _CreateBfcForLibraryMethod, _LeaveProcConverter, _CreateRfcForMethod, _BlockRetry, _MethodRetry, _EvalRetry, _BlockBreak, _MethodBreak, _EvalBreak, _MethodNext, _EvalNext, _MethodRedo, _EvalRedo, _BlockReturn, - _EvalReturn, _BlockYield, _MethodYield, _EvalYield, _MethodProcCall, _CanRescue, _IsRetrySingleton, _PropagateRetrySingleton, _GetRetrySingleton, _CreateMainTopLevelScope, _CreateTopLevelScope, _CreateWrappedTopLevelScope, _CreateModuleEvalScope, _CreateModuleScope, _CreateMethodScope, _CreateBlockScope, _TraceMethodCall, _TraceMethodReturn, _TraceBlockCall, _TraceBlockReturn, - _PrintInteractiveResult, _GetLocalVariable, _SetLocalVariable, _GetContextFromScope, _GetContextFromMethod, _GetContextFromBlockParam, _GetContextFromProc, _GetEmptyScope, _DefineBlock, _InitializeBlock, _Yield0, _Yield1, _Yield2, _Yield3, _Yield4, _YieldN, _YieldSplat0, _YieldSplat1, _YieldSplat2, _YieldSplat3, - _YieldSplat4, _YieldSplatN, _YieldSplatNRhs, _DefineMethod, _MethodDefined, _AliasMethod, _UndefineMethod, _IsDefinedMethod, _DefineGlobalModule, _DefineNestedModule, _DefineModule, _ConvertNamespaceToModule, _DefineSingletonClass, _DefineGlobalClass, _DefineNestedClass, _DefineClass, _GetGlobalConstant, _GetUnqualifiedConstant, _GetQualifiedConstant, _IsDefinedGlobalConstant; + private static MethodInfo _TryGetObjectClassVariable, _TryGetClassVariable, _IsDefinedObjectClassVariable, _IsDefinedClassVariable, _SetObjectClassVariable, _SetClassVariable, _GetInstanceData, _DeserializeObject, _SerializeObject, _HookupEvent, _CreateDelegateFromProc, _CreateDelegateFromMethod, _X, _UpdateProfileTicks, _CreateRfcForMethod, _BlockRetry, _MethodRetry, _EvalRetry, _BlockBreak, + _MethodBreak, _EvalBreak, _MethodNext, _EvalNext, _MethodRedo, _EvalRedo, _BlockReturn, _EvalReturn, _BlockYield, _MethodYield, _EvalYield, _MethodProcCall, _CanRescue, _IsRetrySingleton, _PropagateRetrySingleton, _GetRetrySingleton, _GetCurrentMatchData, _GetCurrentMatchLastGroup, _GetCurrentMatchPrefix, _GetCurrentMatchSuffix, + _MatchLastInputLine, _MatchString, _CreateRegexB, _CreateRegexU, _CreateRegexE, _CreateRegexM, _CreateRegexBM, _CreateRegexUM, _CreateRegexEM, _CreateRegexMB, _CreateRegexMU, _CreateRegexME, _CreateRegexMM, _CreateRegexN, _CreateMutableStringB, _CreateMutableStringU, _CreateMutableStringE, _CreateMutableStringM, _CreateMutableStringBM, _CreateMutableStringUM, + _CreateMutableStringEM, _CreateMutableStringMB, _CreateMutableStringMU, _CreateMutableStringME, _CreateMutableStringMM, _CreateMutableStringN, _CreateSymbolB, _CreateSymbolU, _CreateSymbolE, _CreateSymbolM, _CreateSymbolBM, _CreateSymbolUM, _CreateSymbolEM, _CreateSymbolMB, _CreateSymbolMU, _CreateSymbolME, _CreateSymbolMM, _CreateSymbolN, _CreateEncoding, _IsTrue, + _IsFalse, _GetCurrentException, _SetCurrentExceptionAndStackTrace, _SetCurrentException, _CompareException, _CompareSplattedExceptions, _CompareDefaultException, _GetDefaultExceptionMessage, _MakeWrongNumberOfArgumentsError, _MakeTopLevelSuperException, _MakeMissingSuperException, _MakeInvalidArgumentTypesError, _MakeAmbiguousMatchError, _IsSuperCallTarget, _CreateInclusiveRange, _CreateExclusiveRange, _CreateInclusiveIntegerRange, _CreateExclusiveIntegerRange, _AllocateStructInstance, _CreateStructInstance, + _GetMetaObject, _ToProcValidator, _ToStringValidator, _ToSymbolValidator, _ConvertSymbolIdToSymbol, _ConvertFixnumToSymbol, _ConvertMutableStringToSymbol, _ToRegexValidator, _ToArrayValidator, _ToHashValidator, _ToFixnumValidator, _CreateTypeConversionError, _ConvertBignumToFixnum, _ToSDefaultConversion, _GetInstanceVariable, _IsDefinedInstanceVariable, _SetInstanceVariable, _GetObjectClassVariable, _GetClassVariable, _IsProcConverterTarget, + _CreateBfcForYield, _CreateBfcForMethodProcCall, _CreateBfcForProcCall, _CreateBfcForLibraryMethod, _LeaveProcConverter, _CreateMainTopLevelScope, _CreateTopLevelScope, _CreateWrappedTopLevelScope, _CreateModuleEvalScope, _CreateModuleScope, _CreateMethodScope, _CreateBlockScope, _TraceMethodCall, _TraceMethodReturn, _TraceBlockCall, _TraceBlockReturn, _PrintInteractiveResult, _GetLocalVariable, _SetLocalVariable, _GetContextFromScope, + _GetContextFromMethod, _GetContextFromBlockParam, _GetContextFromProc, _GetEmptyScope, _DefineBlock, _InitializeBlock, _Yield0, _Yield1, _Yield2, _Yield3, _Yield4, _YieldN, _YieldSplat0, _YieldSplat1, _YieldSplat2, _YieldSplat3, _YieldSplat4, _YieldSplatN, _YieldSplatNRhs, _DefineMethod, + _MethodDefined, _AliasMethod, _UndefineMethod, _IsDefinedMethod, _DefineGlobalModule, _DefineNestedModule, _DefineModule, _ConvertNamespaceToModule, _DefineSingletonClass, _DefineGlobalClass, _DefineNestedClass, _DefineClass, _GetGlobalConstant, _GetUnqualifiedConstant, _GetQualifiedConstant, _IsDefinedGlobalConstant, _IsDefinedUnqualifiedConstant, _IsDefinedQualifiedConstant, _SetGlobalConstant, _SetUnqualifiedConstant, + _SetQualifiedConstant, _MakeArray0, _MakeArray1, _MakeArray2, _MakeArray3, _MakeArray4, _MakeArray5, _MakeArrayN, _MakeHash0, _MakeHash, _SplatAppend, _Splat, _SplatPair, _Unsplat, _GetArrayItem, _GetArraySuffix, _GetGlobalVariable, _IsDefinedGlobalVariable, _SetGlobalVariable, _AliasGlobalVariable, + _GetCurrentMatchGroup; - public static MethodInfo/*!*/ CreateExclusiveRange { get { return _CreateExclusiveRange ?? (_CreateExclusiveRange = GetMethod(typeof(RubyOps), "CreateExclusiveRange")); } } - public static MethodInfo/*!*/ CreateInclusiveIntegerRange { get { return _CreateInclusiveIntegerRange ?? (_CreateInclusiveIntegerRange = GetMethod(typeof(RubyOps), "CreateInclusiveIntegerRange")); } } - public static MethodInfo/*!*/ CreateExclusiveIntegerRange { get { return _CreateExclusiveIntegerRange ?? (_CreateExclusiveIntegerRange = GetMethod(typeof(RubyOps), "CreateExclusiveIntegerRange")); } } - public static MethodInfo/*!*/ AllocateStructInstance { get { return _AllocateStructInstance ?? (_AllocateStructInstance = GetMethod(typeof(RubyOps), "AllocateStructInstance")); } } - public static MethodInfo/*!*/ CreateStructInstance { get { return _CreateStructInstance ?? (_CreateStructInstance = GetMethod(typeof(RubyOps), "CreateStructInstance")); } } - public static MethodInfo/*!*/ GetMetaObject { get { return _GetMetaObject ?? (_GetMetaObject = GetMethod(typeof(RubyOps), "GetMetaObject")); } } - public static MethodInfo/*!*/ ToProcValidator { get { return _ToProcValidator ?? (_ToProcValidator = GetMethod(typeof(RubyOps), "ToProcValidator")); } } - public static MethodInfo/*!*/ ToStringValidator { get { return _ToStringValidator ?? (_ToStringValidator = GetMethod(typeof(RubyOps), "ToStringValidator")); } } - public static MethodInfo/*!*/ ToSValidator { get { return _ToSValidator ?? (_ToSValidator = GetMethod(typeof(RubyOps), "ToSValidator")); } } - public static MethodInfo/*!*/ ToSymbolValidator { get { return _ToSymbolValidator ?? (_ToSymbolValidator = GetMethod(typeof(RubyOps), "ToSymbolValidator")); } } - public static MethodInfo/*!*/ ConvertSymbolIdToSymbol { get { return _ConvertSymbolIdToSymbol ?? (_ConvertSymbolIdToSymbol = GetMethod(typeof(RubyOps), "ConvertSymbolIdToSymbol")); } } - public static MethodInfo/*!*/ ConvertFixnumToSymbol { get { return _ConvertFixnumToSymbol ?? (_ConvertFixnumToSymbol = GetMethod(typeof(RubyOps), "ConvertFixnumToSymbol")); } } - public static MethodInfo/*!*/ ConvertMutableStringToSymbol { get { return _ConvertMutableStringToSymbol ?? (_ConvertMutableStringToSymbol = GetMethod(typeof(RubyOps), "ConvertMutableStringToSymbol")); } } - public static MethodInfo/*!*/ ToRegexValidator { get { return _ToRegexValidator ?? (_ToRegexValidator = GetMethod(typeof(RubyOps), "ToRegexValidator")); } } - public static MethodInfo/*!*/ ToArrayValidator { get { return _ToArrayValidator ?? (_ToArrayValidator = GetMethod(typeof(RubyOps), "ToArrayValidator")); } } - public static MethodInfo/*!*/ ToFixnumValidator { get { return _ToFixnumValidator ?? (_ToFixnumValidator = GetMethod(typeof(RubyOps), "ToFixnumValidator")); } } - public static MethodInfo/*!*/ CreateTypeConversionError { get { return _CreateTypeConversionError ?? (_CreateTypeConversionError = GetMethod(typeof(RubyOps), "CreateTypeConversionError")); } } - public static MethodInfo/*!*/ ConvertBignumToFixnum { get { return _ConvertBignumToFixnum ?? (_ConvertBignumToFixnum = GetMethod(typeof(RubyOps), "ConvertBignumToFixnum")); } } - public static MethodInfo/*!*/ GetInstanceVariable { get { return _GetInstanceVariable ?? (_GetInstanceVariable = GetMethod(typeof(RubyOps), "GetInstanceVariable")); } } - public static MethodInfo/*!*/ IsDefinedInstanceVariable { get { return _IsDefinedInstanceVariable ?? (_IsDefinedInstanceVariable = GetMethod(typeof(RubyOps), "IsDefinedInstanceVariable")); } } - public static MethodInfo/*!*/ SetInstanceVariable { get { return _SetInstanceVariable ?? (_SetInstanceVariable = GetMethod(typeof(RubyOps), "SetInstanceVariable")); } } - public static MethodInfo/*!*/ GetObjectClassVariable { get { return _GetObjectClassVariable ?? (_GetObjectClassVariable = GetMethod(typeof(RubyOps), "GetObjectClassVariable")); } } - public static MethodInfo/*!*/ GetClassVariable { get { return _GetClassVariable ?? (_GetClassVariable = GetMethod(typeof(RubyOps), "GetClassVariable")); } } public static MethodInfo/*!*/ TryGetObjectClassVariable { get { return _TryGetObjectClassVariable ?? (_TryGetObjectClassVariable = GetMethod(typeof(RubyOps), "TryGetObjectClassVariable")); } } public static MethodInfo/*!*/ TryGetClassVariable { get { return _TryGetClassVariable ?? (_TryGetClassVariable = GetMethod(typeof(RubyOps), "TryGetClassVariable")); } } public static MethodInfo/*!*/ IsDefinedObjectClassVariable { get { return _IsDefinedObjectClassVariable ?? (_IsDefinedObjectClassVariable = GetMethod(typeof(RubyOps), "IsDefinedObjectClassVariable")); } } @@ -66,31 +44,28 @@ public static MethodInfo/*!*/ CreateDelegateFromProc { get { return _CreateDelegateFromProc ?? (_CreateDelegateFromProc = GetMethod(typeof(RubyOps), "CreateDelegateFromProc")); } } public static MethodInfo/*!*/ CreateDelegateFromMethod { get { return _CreateDelegateFromMethod ?? (_CreateDelegateFromMethod = GetMethod(typeof(RubyOps), "CreateDelegateFromMethod")); } } public static MethodInfo/*!*/ X { get { return _X ?? (_X = GetMethod(typeof(RubyOps), "X")); } } - public static MethodInfo/*!*/ IsDefinedUnqualifiedConstant { get { return _IsDefinedUnqualifiedConstant ?? (_IsDefinedUnqualifiedConstant = GetMethod(typeof(RubyOps), "IsDefinedUnqualifiedConstant")); } } - public static MethodInfo/*!*/ IsDefinedQualifiedConstant { get { return _IsDefinedQualifiedConstant ?? (_IsDefinedQualifiedConstant = GetMethod(typeof(RubyOps), "IsDefinedQualifiedConstant")); } } - public static MethodInfo/*!*/ SetGlobalConstant { get { return _SetGlobalConstant ?? (_SetGlobalConstant = GetMethod(typeof(RubyOps), "SetGlobalConstant")); } } - public static MethodInfo/*!*/ SetUnqualifiedConstant { get { return _SetUnqualifiedConstant ?? (_SetUnqualifiedConstant = GetMethod(typeof(RubyOps), "SetUnqualifiedConstant")); } } - public static MethodInfo/*!*/ SetQualifiedConstant { get { return _SetQualifiedConstant ?? (_SetQualifiedConstant = GetMethod(typeof(RubyOps), "SetQualifiedConstant")); } } - public static MethodInfo/*!*/ MakeArray0 { get { return _MakeArray0 ?? (_MakeArray0 = GetMethod(typeof(RubyOps), "MakeArray0")); } } - public static MethodInfo/*!*/ MakeArray1 { get { return _MakeArray1 ?? (_MakeArray1 = GetMethod(typeof(RubyOps), "MakeArray1")); } } - public static MethodInfo/*!*/ MakeArray2 { get { return _MakeArray2 ?? (_MakeArray2 = GetMethod(typeof(RubyOps), "MakeArray2")); } } - public static MethodInfo/*!*/ MakeArray3 { get { return _MakeArray3 ?? (_MakeArray3 = GetMethod(typeof(RubyOps), "MakeArray3")); } } - public static MethodInfo/*!*/ MakeArray4 { get { return _MakeArray4 ?? (_MakeArray4 = GetMethod(typeof(RubyOps), "MakeArray4")); } } - public static MethodInfo/*!*/ MakeArray5 { get { return _MakeArray5 ?? (_MakeArray5 = GetMethod(typeof(RubyOps), "MakeArray5")); } } - public static MethodInfo/*!*/ MakeArrayN { get { return _MakeArrayN ?? (_MakeArrayN = GetMethod(typeof(RubyOps), "MakeArrayN")); } } - public static MethodInfo/*!*/ MakeHash0 { get { return _MakeHash0 ?? (_MakeHash0 = GetMethod(typeof(RubyOps), "MakeHash0")); } } - public static MethodInfo/*!*/ MakeHash { get { return _MakeHash ?? (_MakeHash = GetMethod(typeof(RubyOps), "MakeHash")); } } - public static MethodInfo/*!*/ SplatAppend { get { return _SplatAppend ?? (_SplatAppend = GetMethod(typeof(RubyOps), "SplatAppend")); } } - public static MethodInfo/*!*/ Splat { get { return _Splat ?? (_Splat = GetMethod(typeof(RubyOps), "Splat")); } } - public static MethodInfo/*!*/ SplatPair { get { return _SplatPair ?? (_SplatPair = GetMethod(typeof(RubyOps), "SplatPair")); } } - public static MethodInfo/*!*/ Unsplat { get { return _Unsplat ?? (_Unsplat = GetMethod(typeof(RubyOps), "Unsplat")); } } - public static MethodInfo/*!*/ GetArrayItem { get { return _GetArrayItem ?? (_GetArrayItem = GetMethod(typeof(RubyOps), "GetArrayItem")); } } - public static MethodInfo/*!*/ GetArraySuffix { get { return _GetArraySuffix ?? (_GetArraySuffix = GetMethod(typeof(RubyOps), "GetArraySuffix")); } } - public static MethodInfo/*!*/ GetGlobalVariable { get { return _GetGlobalVariable ?? (_GetGlobalVariable = GetMethod(typeof(RubyOps), "GetGlobalVariable")); } } - public static MethodInfo/*!*/ IsDefinedGlobalVariable { get { return _IsDefinedGlobalVariable ?? (_IsDefinedGlobalVariable = GetMethod(typeof(RubyOps), "IsDefinedGlobalVariable")); } } - public static MethodInfo/*!*/ SetGlobalVariable { get { return _SetGlobalVariable ?? (_SetGlobalVariable = GetMethod(typeof(RubyOps), "SetGlobalVariable")); } } - public static MethodInfo/*!*/ AliasGlobalVariable { get { return _AliasGlobalVariable ?? (_AliasGlobalVariable = GetMethod(typeof(RubyOps), "AliasGlobalVariable")); } } - public static MethodInfo/*!*/ GetCurrentMatchGroup { get { return _GetCurrentMatchGroup ?? (_GetCurrentMatchGroup = GetMethod(typeof(RubyOps), "GetCurrentMatchGroup")); } } + public static MethodInfo/*!*/ UpdateProfileTicks { get { return _UpdateProfileTicks ?? (_UpdateProfileTicks = GetMethod(typeof(RubyOps), "UpdateProfileTicks")); } } + public static MethodInfo/*!*/ CreateRfcForMethod { get { return _CreateRfcForMethod ?? (_CreateRfcForMethod = GetMethod(typeof(RubyOps), "CreateRfcForMethod")); } } + public static MethodInfo/*!*/ BlockRetry { get { return _BlockRetry ?? (_BlockRetry = GetMethod(typeof(RubyOps), "BlockRetry")); } } + public static MethodInfo/*!*/ MethodRetry { get { return _MethodRetry ?? (_MethodRetry = GetMethod(typeof(RubyOps), "MethodRetry")); } } + public static MethodInfo/*!*/ EvalRetry { get { return _EvalRetry ?? (_EvalRetry = GetMethod(typeof(RubyOps), "EvalRetry")); } } + public static MethodInfo/*!*/ BlockBreak { get { return _BlockBreak ?? (_BlockBreak = GetMethod(typeof(RubyOps), "BlockBreak")); } } + public static MethodInfo/*!*/ MethodBreak { get { return _MethodBreak ?? (_MethodBreak = GetMethod(typeof(RubyOps), "MethodBreak")); } } + public static MethodInfo/*!*/ EvalBreak { get { return _EvalBreak ?? (_EvalBreak = GetMethod(typeof(RubyOps), "EvalBreak")); } } + public static MethodInfo/*!*/ MethodNext { get { return _MethodNext ?? (_MethodNext = GetMethod(typeof(RubyOps), "MethodNext")); } } + public static MethodInfo/*!*/ EvalNext { get { return _EvalNext ?? (_EvalNext = GetMethod(typeof(RubyOps), "EvalNext")); } } + public static MethodInfo/*!*/ MethodRedo { get { return _MethodRedo ?? (_MethodRedo = GetMethod(typeof(RubyOps), "MethodRedo")); } } + public static MethodInfo/*!*/ EvalRedo { get { return _EvalRedo ?? (_EvalRedo = GetMethod(typeof(RubyOps), "EvalRedo")); } } + public static MethodInfo/*!*/ BlockReturn { get { return _BlockReturn ?? (_BlockReturn = GetMethod(typeof(RubyOps), "BlockReturn")); } } + public static MethodInfo/*!*/ EvalReturn { get { return _EvalReturn ?? (_EvalReturn = GetMethod(typeof(RubyOps), "EvalReturn")); } } + public static MethodInfo/*!*/ BlockYield { get { return _BlockYield ?? (_BlockYield = GetMethod(typeof(RubyOps), "BlockYield")); } } + public static MethodInfo/*!*/ MethodYield { get { return _MethodYield ?? (_MethodYield = GetMethod(typeof(RubyOps), "MethodYield")); } } + public static MethodInfo/*!*/ EvalYield { get { return _EvalYield ?? (_EvalYield = GetMethod(typeof(RubyOps), "EvalYield")); } } + public static MethodInfo/*!*/ MethodProcCall { get { return _MethodProcCall ?? (_MethodProcCall = GetMethod(typeof(RubyOps), "MethodProcCall")); } } + public static MethodInfo/*!*/ CanRescue { get { return _CanRescue ?? (_CanRescue = GetMethod(typeof(RubyOps), "CanRescue")); } } + public static MethodInfo/*!*/ IsRetrySingleton { get { return _IsRetrySingleton ?? (_IsRetrySingleton = GetMethod(typeof(RubyOps), "IsRetrySingleton")); } } + public static MethodInfo/*!*/ PropagateRetrySingleton { get { return _PropagateRetrySingleton ?? (_PropagateRetrySingleton = GetMethod(typeof(RubyOps), "PropagateRetrySingleton")); } } + public static MethodInfo/*!*/ GetRetrySingleton { get { return _GetRetrySingleton ?? (_GetRetrySingleton = GetMethod(typeof(RubyOps), "GetRetrySingleton")); } } public static MethodInfo/*!*/ GetCurrentMatchData { get { return _GetCurrentMatchData ?? (_GetCurrentMatchData = GetMethod(typeof(RubyOps), "GetCurrentMatchData")); } } public static MethodInfo/*!*/ GetCurrentMatchLastGroup { get { return _GetCurrentMatchLastGroup ?? (_GetCurrentMatchLastGroup = GetMethod(typeof(RubyOps), "GetCurrentMatchLastGroup")); } } public static MethodInfo/*!*/ GetCurrentMatchPrefix { get { return _GetCurrentMatchPrefix ?? (_GetCurrentMatchPrefix = GetMethod(typeof(RubyOps), "GetCurrentMatchPrefix")); } } @@ -150,34 +125,36 @@ public static MethodInfo/*!*/ MakeAmbiguousMatchError { get { return _MakeAmbiguousMatchError ?? (_MakeAmbiguousMatchError = GetMethod(typeof(RubyOps), "MakeAmbiguousMatchError")); } } public static MethodInfo/*!*/ IsSuperCallTarget { get { return _IsSuperCallTarget ?? (_IsSuperCallTarget = GetMethod(typeof(RubyOps), "IsSuperCallTarget")); } } public static MethodInfo/*!*/ CreateInclusiveRange { get { return _CreateInclusiveRange ?? (_CreateInclusiveRange = GetMethod(typeof(RubyOps), "CreateInclusiveRange")); } } - public static MethodInfo/*!*/ UpdateProfileTicks { get { return _UpdateProfileTicks ?? (_UpdateProfileTicks = GetMethod(typeof(RubyOps), "UpdateProfileTicks")); } } + public static MethodInfo/*!*/ CreateExclusiveRange { get { return _CreateExclusiveRange ?? (_CreateExclusiveRange = GetMethod(typeof(RubyOps), "CreateExclusiveRange")); } } + public static MethodInfo/*!*/ CreateInclusiveIntegerRange { get { return _CreateInclusiveIntegerRange ?? (_CreateInclusiveIntegerRange = GetMethod(typeof(RubyOps), "CreateInclusiveIntegerRange")); } } + public static MethodInfo/*!*/ CreateExclusiveIntegerRange { get { return _CreateExclusiveIntegerRange ?? (_CreateExclusiveIntegerRange = GetMethod(typeof(RubyOps), "CreateExclusiveIntegerRange")); } } + public static MethodInfo/*!*/ AllocateStructInstance { get { return _AllocateStructInstance ?? (_AllocateStructInstance = GetMethod(typeof(RubyOps), "AllocateStructInstance")); } } + public static MethodInfo/*!*/ CreateStructInstance { get { return _CreateStructInstance ?? (_CreateStructInstance = GetMethod(typeof(RubyOps), "CreateStructInstance")); } } + public static MethodInfo/*!*/ GetMetaObject { get { return _GetMetaObject ?? (_GetMetaObject = GetMethod(typeof(RubyOps), "GetMetaObject")); } } + public static MethodInfo/*!*/ ToProcValidator { get { return _ToProcValidator ?? (_ToProcValidator = GetMethod(typeof(RubyOps), "ToProcValidator")); } } + public static MethodInfo/*!*/ ToStringValidator { get { return _ToStringValidator ?? (_ToStringValidator = GetMethod(typeof(RubyOps), "ToStringValidator")); } } + public static MethodInfo/*!*/ ToSymbolValidator { get { return _ToSymbolValidator ?? (_ToSymbolValidator = GetMethod(typeof(RubyOps), "ToSymbolValidator")); } } + public static MethodInfo/*!*/ ConvertSymbolIdToSymbol { get { return _ConvertSymbolIdToSymbol ?? (_ConvertSymbolIdToSymbol = GetMethod(typeof(RubyOps), "ConvertSymbolIdToSymbol")); } } + public static MethodInfo/*!*/ ConvertFixnumToSymbol { get { return _ConvertFixnumToSymbol ?? (_ConvertFixnumToSymbol = GetMethod(typeof(RubyOps), "ConvertFixnumToSymbol")); } } + public static MethodInfo/*!*/ ConvertMutableStringToSymbol { get { return _ConvertMutableStringToSymbol ?? (_ConvertMutableStringToSymbol = GetMethod(typeof(RubyOps), "ConvertMutableStringToSymbol")); } } + public static MethodInfo/*!*/ ToRegexValidator { get { return _ToRegexValidator ?? (_ToRegexValidator = GetMethod(typeof(RubyOps), "ToRegexValidator")); } } + public static MethodInfo/*!*/ ToArrayValidator { get { return _ToArrayValidator ?? (_ToArrayValidator = GetMethod(typeof(RubyOps), "ToArrayValidator")); } } + public static MethodInfo/*!*/ ToHashValidator { get { return _ToHashValidator ?? (_ToHashValidator = GetMethod(typeof(RubyOps), "ToHashValidator")); } } + public static MethodInfo/*!*/ ToFixnumValidator { get { return _ToFixnumValidator ?? (_ToFixnumValidator = GetMethod(typeof(RubyOps), "ToFixnumValidator")); } } + public static MethodInfo/*!*/ CreateTypeConversionError { get { return _CreateTypeConversionError ?? (_CreateTypeConversionError = GetMethod(typeof(RubyOps), "CreateTypeConversionError")); } } + public static MethodInfo/*!*/ ConvertBignumToFixnum { get { return _ConvertBignumToFixnum ?? (_ConvertBignumToFixnum = GetMethod(typeof(RubyOps), "ConvertBignumToFixnum")); } } + public static MethodInfo/*!*/ ToSDefaultConversion { get { return _ToSDefaultConversion ?? (_ToSDefaultConversion = GetMethod(typeof(RubyOps), "ToSDefaultConversion")); } } + public static MethodInfo/*!*/ GetInstanceVariable { get { return _GetInstanceVariable ?? (_GetInstanceVariable = GetMethod(typeof(RubyOps), "GetInstanceVariable")); } } + public static MethodInfo/*!*/ IsDefinedInstanceVariable { get { return _IsDefinedInstanceVariable ?? (_IsDefinedInstanceVariable = GetMethod(typeof(RubyOps), "IsDefinedInstanceVariable")); } } + public static MethodInfo/*!*/ SetInstanceVariable { get { return _SetInstanceVariable ?? (_SetInstanceVariable = GetMethod(typeof(RubyOps), "SetInstanceVariable")); } } + public static MethodInfo/*!*/ GetObjectClassVariable { get { return _GetObjectClassVariable ?? (_GetObjectClassVariable = GetMethod(typeof(RubyOps), "GetObjectClassVariable")); } } + public static MethodInfo/*!*/ GetClassVariable { get { return _GetClassVariable ?? (_GetClassVariable = GetMethod(typeof(RubyOps), "GetClassVariable")); } } public static MethodInfo/*!*/ IsProcConverterTarget { get { return _IsProcConverterTarget ?? (_IsProcConverterTarget = GetMethod(typeof(RubyOps), "IsProcConverterTarget")); } } public static MethodInfo/*!*/ CreateBfcForYield { get { return _CreateBfcForYield ?? (_CreateBfcForYield = GetMethod(typeof(RubyOps), "CreateBfcForYield")); } } public static MethodInfo/*!*/ CreateBfcForMethodProcCall { get { return _CreateBfcForMethodProcCall ?? (_CreateBfcForMethodProcCall = GetMethod(typeof(RubyOps), "CreateBfcForMethodProcCall")); } } public static MethodInfo/*!*/ CreateBfcForProcCall { get { return _CreateBfcForProcCall ?? (_CreateBfcForProcCall = GetMethod(typeof(RubyOps), "CreateBfcForProcCall")); } } public static MethodInfo/*!*/ CreateBfcForLibraryMethod { get { return _CreateBfcForLibraryMethod ?? (_CreateBfcForLibraryMethod = GetMethod(typeof(RubyOps), "CreateBfcForLibraryMethod")); } } public static MethodInfo/*!*/ LeaveProcConverter { get { return _LeaveProcConverter ?? (_LeaveProcConverter = GetMethod(typeof(RubyOps), "LeaveProcConverter")); } } - public static MethodInfo/*!*/ CreateRfcForMethod { get { return _CreateRfcForMethod ?? (_CreateRfcForMethod = GetMethod(typeof(RubyOps), "CreateRfcForMethod")); } } - public static MethodInfo/*!*/ BlockRetry { get { return _BlockRetry ?? (_BlockRetry = GetMethod(typeof(RubyOps), "BlockRetry")); } } - public static MethodInfo/*!*/ MethodRetry { get { return _MethodRetry ?? (_MethodRetry = GetMethod(typeof(RubyOps), "MethodRetry")); } } - public static MethodInfo/*!*/ EvalRetry { get { return _EvalRetry ?? (_EvalRetry = GetMethod(typeof(RubyOps), "EvalRetry")); } } - public static MethodInfo/*!*/ BlockBreak { get { return _BlockBreak ?? (_BlockBreak = GetMethod(typeof(RubyOps), "BlockBreak")); } } - public static MethodInfo/*!*/ MethodBreak { get { return _MethodBreak ?? (_MethodBreak = GetMethod(typeof(RubyOps), "MethodBreak")); } } - public static MethodInfo/*!*/ EvalBreak { get { return _EvalBreak ?? (_EvalBreak = GetMethod(typeof(RubyOps), "EvalBreak")); } } - public static MethodInfo/*!*/ MethodNext { get { return _MethodNext ?? (_MethodNext = GetMethod(typeof(RubyOps), "MethodNext")); } } - public static MethodInfo/*!*/ EvalNext { get { return _EvalNext ?? (_EvalNext = GetMethod(typeof(RubyOps), "EvalNext")); } } - public static MethodInfo/*!*/ MethodRedo { get { return _MethodRedo ?? (_MethodRedo = GetMethod(typeof(RubyOps), "MethodRedo")); } } - public static MethodInfo/*!*/ EvalRedo { get { return _EvalRedo ?? (_EvalRedo = GetMethod(typeof(RubyOps), "EvalRedo")); } } - public static MethodInfo/*!*/ BlockReturn { get { return _BlockReturn ?? (_BlockReturn = GetMethod(typeof(RubyOps), "BlockReturn")); } } - public static MethodInfo/*!*/ EvalReturn { get { return _EvalReturn ?? (_EvalReturn = GetMethod(typeof(RubyOps), "EvalReturn")); } } - public static MethodInfo/*!*/ BlockYield { get { return _BlockYield ?? (_BlockYield = GetMethod(typeof(RubyOps), "BlockYield")); } } - public static MethodInfo/*!*/ MethodYield { get { return _MethodYield ?? (_MethodYield = GetMethod(typeof(RubyOps), "MethodYield")); } } - public static MethodInfo/*!*/ EvalYield { get { return _EvalYield ?? (_EvalYield = GetMethod(typeof(RubyOps), "EvalYield")); } } - public static MethodInfo/*!*/ MethodProcCall { get { return _MethodProcCall ?? (_MethodProcCall = GetMethod(typeof(RubyOps), "MethodProcCall")); } } - public static MethodInfo/*!*/ CanRescue { get { return _CanRescue ?? (_CanRescue = GetMethod(typeof(RubyOps), "CanRescue")); } } - public static MethodInfo/*!*/ IsRetrySingleton { get { return _IsRetrySingleton ?? (_IsRetrySingleton = GetMethod(typeof(RubyOps), "IsRetrySingleton")); } } - public static MethodInfo/*!*/ PropagateRetrySingleton { get { return _PropagateRetrySingleton ?? (_PropagateRetrySingleton = GetMethod(typeof(RubyOps), "PropagateRetrySingleton")); } } - public static MethodInfo/*!*/ GetRetrySingleton { get { return _GetRetrySingleton ?? (_GetRetrySingleton = GetMethod(typeof(RubyOps), "GetRetrySingleton")); } } public static MethodInfo/*!*/ CreateMainTopLevelScope { get { return _CreateMainTopLevelScope ?? (_CreateMainTopLevelScope = GetMethod(typeof(RubyOps), "CreateMainTopLevelScope")); } } public static MethodInfo/*!*/ CreateTopLevelScope { get { return _CreateTopLevelScope ?? (_CreateTopLevelScope = GetMethod(typeof(RubyOps), "CreateTopLevelScope")); } } public static MethodInfo/*!*/ CreateWrappedTopLevelScope { get { return _CreateWrappedTopLevelScope ?? (_CreateWrappedTopLevelScope = GetMethod(typeof(RubyOps), "CreateWrappedTopLevelScope")); } } @@ -229,6 +206,31 @@ public static MethodInfo/*!*/ GetUnqualifiedConstant { get { return _GetUnqualifiedConstant ?? (_GetUnqualifiedConstant = GetMethod(typeof(RubyOps), "GetUnqualifiedConstant")); } } public static MethodInfo/*!*/ GetQualifiedConstant { get { return _GetQualifiedConstant ?? (_GetQualifiedConstant = GetMethod(typeof(RubyOps), "GetQualifiedConstant")); } } public static MethodInfo/*!*/ IsDefinedGlobalConstant { get { return _IsDefinedGlobalConstant ?? (_IsDefinedGlobalConstant = GetMethod(typeof(RubyOps), "IsDefinedGlobalConstant")); } } + public static MethodInfo/*!*/ IsDefinedUnqualifiedConstant { get { return _IsDefinedUnqualifiedConstant ?? (_IsDefinedUnqualifiedConstant = GetMethod(typeof(RubyOps), "IsDefinedUnqualifiedConstant")); } } + public static MethodInfo/*!*/ IsDefinedQualifiedConstant { get { return _IsDefinedQualifiedConstant ?? (_IsDefinedQualifiedConstant = GetMethod(typeof(RubyOps), "IsDefinedQualifiedConstant")); } } + public static MethodInfo/*!*/ SetGlobalConstant { get { return _SetGlobalConstant ?? (_SetGlobalConstant = GetMethod(typeof(RubyOps), "SetGlobalConstant")); } } + public static MethodInfo/*!*/ SetUnqualifiedConstant { get { return _SetUnqualifiedConstant ?? (_SetUnqualifiedConstant = GetMethod(typeof(RubyOps), "SetUnqualifiedConstant")); } } + public static MethodInfo/*!*/ SetQualifiedConstant { get { return _SetQualifiedConstant ?? (_SetQualifiedConstant = GetMethod(typeof(RubyOps), "SetQualifiedConstant")); } } + public static MethodInfo/*!*/ MakeArray0 { get { return _MakeArray0 ?? (_MakeArray0 = GetMethod(typeof(RubyOps), "MakeArray0")); } } + public static MethodInfo/*!*/ MakeArray1 { get { return _MakeArray1 ?? (_MakeArray1 = GetMethod(typeof(RubyOps), "MakeArray1")); } } + public static MethodInfo/*!*/ MakeArray2 { get { return _MakeArray2 ?? (_MakeArray2 = GetMethod(typeof(RubyOps), "MakeArray2")); } } + public static MethodInfo/*!*/ MakeArray3 { get { return _MakeArray3 ?? (_MakeArray3 = GetMethod(typeof(RubyOps), "MakeArray3")); } } + public static MethodInfo/*!*/ MakeArray4 { get { return _MakeArray4 ?? (_MakeArray4 = GetMethod(typeof(RubyOps), "MakeArray4")); } } + public static MethodInfo/*!*/ MakeArray5 { get { return _MakeArray5 ?? (_MakeArray5 = GetMethod(typeof(RubyOps), "MakeArray5")); } } + public static MethodInfo/*!*/ MakeArrayN { get { return _MakeArrayN ?? (_MakeArrayN = GetMethod(typeof(RubyOps), "MakeArrayN")); } } + public static MethodInfo/*!*/ MakeHash0 { get { return _MakeHash0 ?? (_MakeHash0 = GetMethod(typeof(RubyOps), "MakeHash0")); } } + public static MethodInfo/*!*/ MakeHash { get { return _MakeHash ?? (_MakeHash = GetMethod(typeof(RubyOps), "MakeHash")); } } + public static MethodInfo/*!*/ SplatAppend { get { return _SplatAppend ?? (_SplatAppend = GetMethod(typeof(RubyOps), "SplatAppend")); } } + public static MethodInfo/*!*/ Splat { get { return _Splat ?? (_Splat = GetMethod(typeof(RubyOps), "Splat")); } } + public static MethodInfo/*!*/ SplatPair { get { return _SplatPair ?? (_SplatPair = GetMethod(typeof(RubyOps), "SplatPair")); } } + public static MethodInfo/*!*/ Unsplat { get { return _Unsplat ?? (_Unsplat = GetMethod(typeof(RubyOps), "Unsplat")); } } + public static MethodInfo/*!*/ GetArrayItem { get { return _GetArrayItem ?? (_GetArrayItem = GetMethod(typeof(RubyOps), "GetArrayItem")); } } + public static MethodInfo/*!*/ GetArraySuffix { get { return _GetArraySuffix ?? (_GetArraySuffix = GetMethod(typeof(RubyOps), "GetArraySuffix")); } } + public static MethodInfo/*!*/ GetGlobalVariable { get { return _GetGlobalVariable ?? (_GetGlobalVariable = GetMethod(typeof(RubyOps), "GetGlobalVariable")); } } + public static MethodInfo/*!*/ IsDefinedGlobalVariable { get { return _IsDefinedGlobalVariable ?? (_IsDefinedGlobalVariable = GetMethod(typeof(RubyOps), "IsDefinedGlobalVariable")); } } + public static MethodInfo/*!*/ SetGlobalVariable { get { return _SetGlobalVariable ?? (_SetGlobalVariable = GetMethod(typeof(RubyOps), "SetGlobalVariable")); } } + public static MethodInfo/*!*/ AliasGlobalVariable { get { return _AliasGlobalVariable ?? (_AliasGlobalVariable = GetMethod(typeof(RubyOps), "AliasGlobalVariable")); } } + public static MethodInfo/*!*/ GetCurrentMatchGroup { get { return _GetCurrentMatchGroup ?? (_GetCurrentMatchGroup = GetMethod(typeof(RubyOps), "GetCurrentMatchGroup")); } } public static MethodInfo/*!*/ CreateRegex(string/*!*/ suffix) { switch (suffix) { =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/BlockReference.cs;C653999 File: BlockReference.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/BlockReference.cs;C653999 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/BlockReference.cs;MoreSites4 @@ -43,7 +43,7 @@ return Ast.Dynamic( ConvertToProcAction.Instance, typeof(Proc), - gen.CurrentScopeVariable, _expression.TransformRead(gen) + Methods.GetContextFromScope.OpCall(gen.CurrentScopeVariable), _expression.TransformRead(gen) ); } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/SourceUnitTree.cs;C667392 File: SourceUnitTree.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/SourceUnitTree.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/SourceUnitTree.cs;MoreSites4 @@ -158,7 +158,7 @@ var resultVariable = scope.DefineHiddenVariable("#result", typeof(object)); var epilogue = Methods.PrintInteractiveResult.OpCall(runtimeScopeVariable, - Ast.Dynamic(ConvertToSAction.Instance, typeof(MutableString), gen.CurrentScopeVariable, + Ast.Dynamic(ConvertToSAction.Instance, typeof(MutableString), Methods.GetContextFromScope.OpCall(gen.CurrentScopeVariable), Ast.Dynamic(RubyCallAction.Make("inspect", RubyCallSignature.WithScope(0)), typeof(object), gen.CurrentScopeVariable, resultVariable ) =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Clauses/RescueClause.cs;C667392 File: RescueClause.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Clauses/RescueClause.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Clauses/RescueClause.cs;MoreSites4 @@ -153,7 +153,7 @@ return Ast.Dynamic( TryConvertToArrayAction.Instance, typeof(object), - gen.CurrentScopeVariable, + Methods.GetContextFromScope.OpCall(gen.CurrentScopeVariable), _splatType.TransformRead(gen) ); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MatchExpression.cs;C633889 File: MatchExpression.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MatchExpression.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MatchExpression.cs;MoreSites4 @@ -51,7 +51,11 @@ internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) { return Methods.MatchString.OpCall( - Ast.Dynamic(ConvertToStrAction.Instance, typeof(MutableString), gen.CurrentScopeVariable, _expression.Transform(gen)), + Ast.Dynamic( + ConvertToStrAction.Instance, + typeof(MutableString), + Methods.GetContextFromScope.OpCall(gen.CurrentScopeVariable), _expression.Transform(gen) + ), _regex.Transform(gen), gen.CurrentScopeVariable ); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/RangeExpression.cs;C659171 File: RangeExpression.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/RangeExpression.cs;C659171 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/RangeExpression.cs;MoreSites4 @@ -85,7 +85,7 @@ AstFactory.Box(_begin.TransformRead(gen)), AstFactory.Box(_end.TransformRead(gen)), gen.CurrentScopeVariable, - Ast.Constant(new SiteLocalStorage>>()) + Ast.Constant(new BinaryOpStorage()) ); } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/StringConstructor.cs;C653999 File: StringConstructor.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/StringConstructor.cs;C653999 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/StringConstructor.cs;MoreSites4 @@ -161,7 +161,7 @@ Ast.Dynamic( ConvertToSAction.Instance, typeof(MutableString), - gen.CurrentScopeVariable, part.TransformRead(gen) + Methods.GetContextFromScope.OpCall(gen.CurrentScopeVariable), part.TransformRead(gen) ) ); opName.Append(RubyOps.SuffixMutable); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Parser.cs;C667392 File: Parser.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Parser.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Parser.cs;MoreSites4 @@ -126,7 +126,9 @@ } public Parser(ErrorSink/*!*/ errorSink) { - _tokenizer = new Tokenizer(false, errorSink, this); + _tokenizer = new Tokenizer(false, this) { + ErrorSink = errorSink + }; InitializeTables(); } @@ -161,7 +163,7 @@ if (_tokenizer.UnterminatedToken) { props = ScriptCodeParseResult.IncompleteToken; - } else if (_tokenizer.IsEndOfFile) { + } else if (_tokenizer.EndOfFileReached) { props = ScriptCodeParseResult.IncompleteStatement; } else { props = ScriptCodeParseResult.Invalid; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Symbols.cs;C633889 File: Symbols.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Symbols.cs;C633889 (server) 12/9/2008 2:23 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Symbols.cs;MoreSites4 @@ -38,6 +38,7 @@ public static readonly string ToS = "to_s"; public static readonly string ToStr = "to_str"; public static readonly string ToAry = "to_ary"; + public static readonly string ToHash = "to_hash"; public static readonly string ToInt = "to_int"; public static readonly string Initialize = "initialize"; public static readonly string InitializeCopy = "initialize_copy"; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Tokenizer.cs;C667392 File: Tokenizer.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Tokenizer.cs;C667392 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Parser/Tokenizer.cs;MoreSites4 @@ -28,21 +28,21 @@ using System.Text.RegularExpressions; namespace IronRuby.Compiler { - public enum LexicalState { - EXPR_BEG, /* ignore newline, +/- is a sign. */ - EXPR_END, /* newline significant, +/- is a operator. */ - EXPR_ARG, /* newline significant, +/- is a operator. */ - EXPR_CMDARG, /* newline significant, +/- is a operator. */ - EXPR_ENDARG, /* newline significant, +/- is a operator. */ - EXPR_MID, /* newline significant, +/- is a operator. */ - EXPR_FNAME, /* ignore newline, no reserved words. */ - EXPR_DOT, /* right after `.' or `::', no reserved words. */ - EXPR_CLASS, /* immediate after `class', no here document. */ + internal enum LexicalState { + EXPR_BEG, // ignore newline, +/- is a sign. + EXPR_END, // newline significant, +/- is a operator. + EXPR_ARG, // newline significant, +/- is a operator. + EXPR_CMDARG, // newline significant, +/- is a operator. + EXPR_ENDARG, // newline significant, +/- is a operator. + EXPR_MID, // newline significant, +/- is a operator. + EXPR_FNAME, // ignore newline, no reserved words. + EXPR_DOT, // right after `.' or `::', no reserved words. + EXPR_CLASS, // immediate after `class', no here document. }; public class Tokenizer : TokenizerService { public sealed class BignumParser : UnsignedBigIntegerParser { - private char[] _buffer; // TODO: TokenizerBuffer + private char[] _buffer; private int _position; public int Position { get { return _position; } set { _position = value; } } @@ -71,125 +71,92 @@ } } - #region DLR - - private const int DefaultBufferCapacity = 1024; - - // tokenizer properties: + private const int InitialBufferSize = 80; + + private TextReader _input; + private SourceLocation _initialLocation; + private RubyCompatibility _compatibility; + private bool _verbatim; + private SourceUnit _sourceUnit; - - //private TokenizerBuffer _buffer; private ErrorSink/*!*/ _errorSink; - private TokenValue _tokenValue; - private bool _verbatim; - private bool _eofReached; - - // __END__ - private int _dataOffset; - - private RubyCompatibility _compatibility; - + private BignumParser _bigIntParser; private ILexicalVariableResolver/*!*/ _localVariableResolver; + + #region State - public override object CurrentState { - get { return null; } - } + private LexicalState _lexicalState; + private bool _commaStart = true; + private StringTokenizer _currentString = null; + private int _cmdArgStack = 0; + private int _condStack = 0; - public SourceUnit SourceUnit { - get { return _sourceUnit; } - } + // Non-zero => End of the last heredoc that finished reading content. + // While non-zero the current stream position doesn't correspond the current line and line index + // (the stream is ahead, we are reading from a buffer restored by the last heredoc). + private int _heredocEndLine; + private int _heredocEndLineIndex = -1; - public int DataOffset { - get { return _dataOffset; } - } + #endregion - public override ErrorSink/*!*/ ErrorSink { - get { return _errorSink; } - set { - ContractUtils.RequiresNotNull(value, "value"); - _errorSink = value; - } - } + // Entire line that is currently being tokenized. + // Includes \r, \n, \r\n if there was eoln in input. + private char[] _lineBuffer; - public RubyCompatibility Compatibility { - get { return _compatibility; } - set { _compatibility = value; } - } + // Portion of _lineBuffer that contains valid data. + private int _lineLength; - public override bool IsRestartable { - get { return false; } - } + // index in the current buffer/line: + private int _bufferPos; - internal bool IsEndOfFile { - get { - return _eofReached; - } - } + // current line no: + private int _currentLine; + private int _currentLineIndex; + + // out: whether the last token terminated + private bool _unterminatedToken; + private bool _eofReached; + // out: offset data following __END__ token + private int _dataOffset; + // out: token value: + private TokenValue _tokenValue; + + // token positions set during tokenization (TODO: to be replaced by tokenizer buffer): + private SourceLocation _currentTokenStart; + private SourceLocation _currentTokenEnd; + private int _currentTokenStartIndex; - public override SourceLocation CurrentPosition { - get { return _tokenSpan.End; } // TODO: ??? - } + // last token span: + private SourceSpan _tokenSpan; + + #region Initialization - public SourceSpan TokenSpan { - get { - return _tokenSpan; - } - } - - public TokenValue TokenValue { - get { - return _tokenValue; - } - } - - internal LexicalState LexicalState { - get { - return _lexicalState; - } - } - public Tokenizer() : this(true) { } public Tokenizer(bool verbatim) - : this(verbatim, ErrorSink.Null) { + : this(verbatim, DummyVariableResolver.AllMethodNames) { } - public Tokenizer(bool verbatim, ErrorSink/*!*/ errorSink) - : this(verbatim, errorSink, DummyVariableResolver.AllMethodNames) { - } - - public Tokenizer(bool verbatim, ErrorSink/*!*/ errorSink, ILexicalVariableResolver/*!*/ localVariableResolver) { - ContractUtils.RequiresNotNull(errorSink, "errorSink"); + public Tokenizer(bool verbatim, ILexicalVariableResolver/*!*/ localVariableResolver) { ContractUtils.RequiresNotNull(localVariableResolver, "localVariableResolver"); - _bigIntParser = new BignumParser(); - _errorSink = errorSink; - _sourceUnit = null; + _errorSink = ErrorSink.Null; _localVariableResolver = localVariableResolver; _verbatim = verbatim; - _compatibility = RubyCompatibility.Default; - _initialLocation = SourceLocation.Invalid; - _tokenSpan = SourceSpan.Invalid; - _tokenValue = new TokenValue(); - _bufferPos = 0; - - // TODO: - _input = null; } - public void Initialize(SourceUnit sourceUnit) { + public void Initialize(SourceUnit/*!*/ sourceUnit) { ContractUtils.RequiresNotNull(sourceUnit, "sourceUnit"); - - Initialize(null, sourceUnit.GetReader(), sourceUnit, SourceLocation.MinValue, DefaultBufferCapacity); + Initialize(null, sourceUnit.GetReader(), sourceUnit, SourceLocation.MinValue); } - public override void Initialize(object state, TextReader/*!*/ reader, SourceUnit/*!*/ sourceUnit, SourceLocation initialLocation) { - Initialize(state, reader, sourceUnit, initialLocation, DefaultBufferCapacity); + public void Initialize(TextReader/*!*/ reader) { + Initialize(null, reader, null, SourceLocation.MinValue); } - public void Initialize(object state, TextReader/*!*/ reader, SourceUnit sourceUnit, SourceLocation initialLocation, int bufferCapacity) { + public override void Initialize(object state, TextReader/*!*/ reader, SourceUnit sourceUnit, SourceLocation initialLocation) { ContractUtils.RequiresNotNull(reader, "reader"); _sourceUnit = sourceUnit; @@ -199,63 +166,18 @@ _currentLine = _initialLocation.Line; _currentLineIndex = _initialLocation.Index; _tokenSpan = new SourceSpan(initialLocation, initialLocation); + + SetState(LexicalState.EXPR_BEG); + _tokenValue = new TokenValue(); - _eofReached = false; - SetState(LexicalState.EXPR_BEG); - - UnterminatedToken = false; + _unterminatedToken = false; DumpBeginningOfUnit(); } #endregion - private readonly BignumParser/*!*/ _bigIntParser; - private LexicalState _lexicalState; - - private bool _commaStart = true; - private StringTokenizer _currentString = null; - - private TextReader _input; - - private const int InitialBufferSize = 80; - - // Entire line that is currently being tokenized. - // Includes \r, \n, \r\n if there was eoln in input. - private char[] _lineBuffer; - - // Portion of _lineBuffer that contains valid data. - private int _lineLength; - - // index in the current buffer/line: - private int _bufferPos; - - // current line no: - private int _currentLine; - private int _currentLineIndex; - - // Non-zero => End of the last heredoc that finished reading content. - // While non-zero the current stream position doesn't correspond the current line and line index - // (the stream is ahead, we are reading from a buffer restored by the last heredoc). - private int _heredocEndLine; - private int _heredocEndLineIndex = -1; - - private SourceLocation _initialLocation; - - private int _cmdArgStack = 0; - private int _condStack = 0; - - internal bool UnterminatedToken; - - // token positions set during tokenization (TODO: to be replaced by tokenizer buffer): - private SourceLocation _currentTokenStart; - private SourceLocation _currentTokenEnd; - private int _currentTokenStartIndex; - - // last token span: - private SourceSpan _tokenSpan; - #region Debug Logging #if DEBUG @@ -306,13 +228,17 @@ #endregion - #region Parser Callbacks, State Operations + #region Parser API, State Operations + internal LexicalState LexicalState { + get { return _lexicalState; } + } + private bool IS_ARG() { return _lexicalState == LexicalState.EXPR_ARG || _lexicalState == LexicalState.EXPR_CMDARG; } - public void SetState(LexicalState state) { + internal void SetState(LexicalState state) { _lexicalState = state; } @@ -611,6 +537,8 @@ #endregion + #region Token Spans + private void MarkTokenEnd(bool isMultiLine) { if (isMultiLine) { MarkMultiLineTokenEnd(); @@ -656,26 +584,15 @@ return new SourceSpan(loc, loc); } - public Tokens GetNextToken() { - //if (_buffer == null) throw new InvalidOperationException("Uninitialized"); - if (_input == null) throw new InvalidOperationException("Uninitialized"); + #endregion -#if DEBUG - _tokenValue = new TokenValue(); -#endif + #region Main Tokenization - Tokens result = Tokenize(); - - if (result == Tokens.EndOfFile) { - _eofReached = true; + public Tokens GetNextToken() { + if (_input == null) { + throw new InvalidOperationException("Uninitialized"); } - return result; - } - - private Tokens Tokenize() { - bool whitespaceSeen = false; - if (_currentString != null) { // TODO: RefillBuffer(); @@ -690,6 +607,7 @@ return token; } + bool whitespaceSeen = false; bool cmdState = _commaStart; _commaStart = false; @@ -718,6 +636,10 @@ case Tokens.EndOfLine: // not considered whitespace case Tokens.InvalidCharacter: continue; + + case Tokens.EndOfFile: + _eofReached = true; + break; } return token; @@ -892,6 +814,10 @@ } } + #endregion + + #region End-Of-Line + private Tokens ReadNonEolnWhiteSpace() { while (true) { int c = Peek(); @@ -985,6 +911,8 @@ return c; } + #endregion + #region Identifiers and Keywords // Identifiers: @@ -1168,7 +1096,7 @@ int c = Read(); if (c == -1) { - UnterminatedToken = true; + _unterminatedToken = true; ReportError(Errors.UnterminatedEmbeddedDocument); return true; } @@ -1210,7 +1138,9 @@ } #endregion - + + #region Tokens + // Assignment: = // Operators: == === =~ => private Tokens ReadEquals() { @@ -1865,7 +1795,7 @@ // ?[:EOF:] int c = Peek(); if (c == -1) { - UnterminatedToken = true; + _unterminatedToken = true; MarkSingleLineTokenEnd(); ReportError(Errors.IncompleteCharacter); return Tokens.EndOfFile; @@ -2091,6 +2021,8 @@ return options | encoding; } + #endregion + #region Character Escapes // \\ \n \t \r \f \v \a \b \s @@ -2501,7 +2433,7 @@ // unterminated string (error recovery is slightly different from MRI): if (c == -1) { ReportError(Errors.UnterminatedString); - UnterminatedToken = true; + _unterminatedToken = true; MarkSingleLineTokenEnd(); return Tokens.StringEnd; } @@ -2608,7 +2540,7 @@ while (true) { c = Read(); if (c == -1) { - UnterminatedToken = true; + _unterminatedToken = true; ReportError(Errors.UnterminatedHereDocIdentifier); c = term; break; @@ -2676,7 +2608,7 @@ ReportError(Errors.UnterminatedHereDoc, heredoc.Label); MarkSingleLineTokenEnd(); HeredocRestore(heredoc); - UnterminatedToken = true; + _unterminatedToken = true; return Tokens.StringEnd; } @@ -2818,6 +2750,8 @@ #endregion + #region String Quotations + // Quotation start: // %[QqWwxrs]?[^:alpha-numeric:] private Tokens TokenizeQuotationStart() { @@ -2884,7 +2818,7 @@ int parenthesis = terminator; switch (terminator) { case -1: - UnterminatedToken = true; + _unterminatedToken = true; MarkSingleLineTokenEnd(); ReportError(Errors.UnterminatedQuotedString); return Tokens.EndOfFile; @@ -2923,6 +2857,8 @@ return token; } + #endregion + #region Numbers private enum NumericCharKind { @@ -3201,6 +3137,10 @@ // TODO: store only the digit count, the actual value will be parsed later: // TODO: skip initial zeros + if (_bigIntParser == null) { + _bigIntParser = new BignumParser(); + } + _bigIntParser.Position = numberStartIndex; _bigIntParser.Buffer = _lineBuffer; @@ -3298,6 +3238,21 @@ return Double.TryParse(sb.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out result); } + private static bool TryDecodeDouble(string/*!*/ str, int first, int end, out double result) { + StringBuilder sb = new StringBuilder(end - first); + sb.Length = end - first; + + int j = 0; + for (int i = first; i < end; i++) { + if (str[i] != '_') { + sb[j++] = str[i]; + } + } + + sb.Length = j; + return Double.TryParse(sb.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out result); + } + private Tokens DecodeDouble(int first, int end) { double result; if (!TryDecodeDouble(_lineBuffer, first, end, out result)) { @@ -3310,7 +3265,7 @@ #endregion - #region Characters + #region Character Categories public static bool IsDecimalDigit(int c) { return unchecked((uint)c - '0' <= (uint)'9' - '0'); @@ -3412,26 +3367,63 @@ #region Public API - private static int nextc(char[]/*!*/ str, ref int i) { + public SourceUnit SourceUnit { + get { return _sourceUnit; } + } + + public int DataOffset { + get { return _dataOffset; } + } + + public RubyCompatibility Compatibility { + get { return _compatibility; } + set { _compatibility = value; } + } + + public SourceSpan TokenSpan { + get { return _tokenSpan; } + } + + public TokenValue TokenValue { + get { return _tokenValue; } + } + + public bool EndOfFileReached { + get { return _eofReached; } + } + + public bool UnterminatedToken { + get { return _unterminatedToken; } + } + + private static int Read(string/*!*/ str, ref int i) { i++; return (i < str.Length) ? str[i] : -1; } // subsequent _ are not considered error - public static double ParseDouble(char[]/*!*/ str) { + public static bool TryParseDouble(string/*!*/ str, out double result, out bool complete) { double sign; int i = -1; int c; - do { c = nextc(str, ref i); } while (IsWhiteSpace(c)); + do { c = Read(str, ref i); } while (IsWhiteSpace(c)); if (c == '-') { - c = nextc(str, ref i); - if (c == '_') return 0.0; + c = Read(str, ref i); + if (c == '_') { + result = 0.0; + complete = false; + return false; + } sign = -1; } else if (c == '+') { - c = nextc(str, ref i); - if (c == '_') return 0.0; + c = Read(str, ref i); + if (c == '_') { + result = 0.0; + complete = false; + return false; + } sign = +1; } else { sign = +1; @@ -3440,13 +3432,13 @@ int start = i; while (c == '_' || IsDecimalDigit(c)) { - c = nextc(str, ref i); + c = Read(str, ref i); } if (c == '.') { - c = nextc(str, ref i); + c = Read(str, ref i); while (c == '_' || IsDecimalDigit(c)) { - c = nextc(str, ref i); + c = Read(str, ref i); } } @@ -3454,9 +3446,9 @@ int end = i; if (c == 'e' || c == 'E') { - c = nextc(str, ref i); + c = Read(str, ref i); if (c == '+' || c == '-') { - c = nextc(str, ref i); + c = Read(str, ref i); } int expEnd = end; @@ -3467,14 +3459,16 @@ } else if (c != '_') { break; } - c = nextc(str, ref i); + c = Read(str, ref i); } end = expEnd; } - double result; - return TryDecodeDouble(str, start, end, out result) ? result * sign : 0.0; + bool success = TryDecodeDouble(str, start, end, out result); + result *= sign; + complete = end == str.Length; + return success; } private const string EncodingHeaderPattern = @"^[#].*?coding\s*[:=]\s*(?[a-z0-9_-]+)"; @@ -3558,6 +3552,26 @@ #region Tokenizer Service + public override object CurrentState { + get { return null; } + } + + public override ErrorSink/*!*/ ErrorSink { + get { return _errorSink; } + set { + ContractUtils.RequiresNotNull(value, "value"); + _errorSink = value; + } + } + + public override bool IsRestartable { + get { return false; } + } + + public override SourceLocation CurrentPosition { + get { return _tokenSpan.End; } // TODO: ??? + } + public override bool SkipToken() { return GetNextToken() != Tokens.EndOfFile; } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Loader.cs;C645816 File: Loader.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Loader.cs;C645816 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Loader.cs;MoreSites4 @@ -492,7 +492,7 @@ throw RubyExceptions.CreateTypeConversionError("nil", "String"); } - result[i] = _toStrSite.Target(_toStrSite, _context.EmptyScope, loadPaths[i]).ConvertToString(); + result[i] = _toStrSite.Target(_toStrSite, _context, loadPaths[i]).ConvertToString(); } return result; @@ -571,7 +571,8 @@ #region Global Variables - private readonly CallSite> _toStrSite = CallSite>.Create(ConvertToStrAction.Instance); + private readonly CallSite> _toStrSite = + CallSite>.Create(ConvertToStrAction.Instance); internal object[]/*!*/ GetLoadPaths() { lock (_loadedFiles) { @@ -647,7 +648,7 @@ } // case sensitive comparison: - if (path.Equals(_toStrSite.Target(_toStrSite, _context.EmptyScope, file))) { + if (path.Equals(_toStrSite.Target(_toStrSite, _context, file))) { return true; } } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;C669880 File: RubyContext.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;MoreSites4 @@ -1125,6 +1125,10 @@ return _referenceTypeInstanceData.GetValue(obj); } + public bool HasInstanceVariables(object obj) { + return TryGetInstanceData(obj) != null; + } + public string[]/*!*/ GetInstanceVariableNames(object obj) { RubyInstanceData data = TryGetInstanceData(obj); return (data != null) ? data.GetInstanceVariableNames() : ArrayUtils.EmptyStrings; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptions.cs;C659171 File: RubyExceptions.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptions.cs;C659171 (server) 12/9/2008 3:20 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptions.cs;MoreSites4 @@ -23,6 +23,8 @@ using IronRuby.Compiler; using System.Runtime.InteropServices; using System.Net.Sockets; +using System.Runtime.CompilerServices; +using IronRuby.Runtime.Calls; namespace IronRuby.Runtime { /// @@ -139,6 +141,8 @@ return FormatMethodMissingMessage(context, self, name, "undefined method `{0}' for {1}"); } + private static readonly UnaryOpStorage/*!*/ ToSSiteStorage = new UnaryOpStorage(); + private static string/*!*/ FormatMethodMissingMessage(RubyContext/*!*/ context, object self, string/*!*/ name, string/*!*/ message) { Assert.NotNull(name); string strObject; @@ -146,7 +150,10 @@ if (self == null) { strObject = "nil:NilClass"; } else { - strObject = RubySites.ToS(context, self).ConvertToString(); + // TODO: cross-runtime + var site = ToSSiteStorage.GetCallSite("to_s", RubyCallSignature.WithImplicitSelf(0)); + strObject = (site.Target(site, context, self) as MutableString ?? RubyUtils.ObjectToMutableString(context, self)).ConvertToString(); + if (!strObject.StartsWith("#")) { strObject += ":" + RubyUtils.GetClassName(context, self); } =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C672727 File: RubyOps.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C672727 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;MoreSites4 @@ -37,9 +37,6 @@ using System.Runtime.InteropServices; using Microsoft.Scripting.Generation; -using BinaryOpSite = System.Runtime.CompilerServices.CallSite>; - namespace IronRuby.Runtime { public static partial class RubyOps { @@ -1329,12 +1326,12 @@ } [Emitted] - public static Range/*!*/ CreateInclusiveRange(object begin, object end, RubyScope/*!*/ scope, SiteLocalStorage/*!*/ comparisonStorage) { + public static Range/*!*/ CreateInclusiveRange(object begin, object end, RubyScope/*!*/ scope, BinaryOpStorage/*!*/ comparisonStorage) { return new Range(comparisonStorage, scope.RubyContext, begin, end, false); } [Emitted] - public static Range/*!*/ CreateExclusiveRange(object begin, object end, RubyScope/*!*/ scope, SiteLocalStorage/*!*/ comparisonStorage) { + public static Range/*!*/ CreateExclusiveRange(object begin, object end, RubyScope/*!*/ scope, BinaryOpStorage/*!*/ comparisonStorage) { return new Range(comparisonStorage, scope.RubyContext, begin, end, true); } @@ -1369,7 +1366,7 @@ #region Dynamic Actions - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static Proc/*!*/ ToProcValidator(string/*!*/ className, object obj) { Proc result = obj as Proc; if (result == null) { @@ -1378,7 +1375,7 @@ return result; } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static MutableString/*!*/ ToStringValidator(string/*!*/ className, object obj) { MutableString result = obj as MutableString; if (result == null) { @@ -1387,16 +1384,7 @@ return result; } - [Emitted] //ProtocolConversionAction - public static MutableString/*!*/ ToSValidator(string/*!*/ className, object obj) { - MutableString result = obj as MutableString; - if (result == null) { - throw new InvalidOperationException(String.Format("{0}#to_s should return String", className)); - } - return result; - } - - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static string/*!*/ ToSymbolValidator(string/*!*/ className, object obj) { var str = obj as MutableString; if (str == null) { @@ -1405,12 +1393,12 @@ return str.ConvertToString(); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static string/*!*/ ConvertSymbolIdToSymbol(SymbolId value) { return SymbolTable.IdToString(value); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static string/*!*/ ConvertFixnumToSymbol(RubyContext/*!*/ context, int value) { context.ReportWarning("do not use Fixnums as Symbols"); @@ -1427,26 +1415,35 @@ return !symbol.IsEmpty && SymbolTable.ContainsId(symbol); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static string/*!*/ ConvertMutableStringToSymbol(MutableString/*!*/ value) { return value.ConvertToString(); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static RubyRegex/*!*/ ToRegexValidator(string/*!*/ className, object obj) { return new RubyRegex(RubyRegex.Escape(ToStringValidator(className, obj)), RubyRegexOptions.NONE); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static IList/*!*/ ToArrayValidator(string/*!*/ className, object obj) { - IList result = obj as IList; + var result = obj as IList; if (result == null) { throw new InvalidOperationException(String.Format("{0}#to_ary should return Array", className)); } return result; } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction + public static IDictionary/*!*/ ToHashValidator(string/*!*/ className, object obj) { + var result = obj as IDictionary; + if (result == null) { + throw new InvalidOperationException(String.Format("{0}#to_hash should return Hash", className)); + } + return result; + } + + [Emitted] // ProtocolConversionAction public static int ToFixnumValidator(string/*!*/ className, object obj) { if (obj is int) { return (int)obj; @@ -1464,12 +1461,12 @@ throw new InvalidOperationException(String.Format("{0}#to_int should return Integer", className)); } - [Emitted] //ProtocolConversionAction + [Emitted] // ProtocolConversionAction public static Exception/*!*/ CreateTypeConversionError(string/*!*/ fromType, string/*!*/ toType) { return RubyExceptions.CreateTypeConversionError(fromType, toType); } - [Emitted] //ConvertToFixnumAction + [Emitted] // ConvertToFixnumAction public static int ConvertBignumToFixnum(BigInteger/*!*/ bignum) { int fixnum; if (bignum.AsInt32(out fixnum)) { @@ -1478,6 +1475,11 @@ throw RubyExceptions.CreateRangeError("bignum too big to convert into `long'"); } + [Emitted] // ConvertToSAction + public static MutableString/*!*/ ToSDefaultConversion(RubyContext/*!*/ context, object obj) { + return obj as MutableString ?? RubyUtils.ObjectToMutableString(context, obj); + } + #endregion #region Called by GetHashCode/Equals methods in generated .NET classes =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C669880 File: RubyUtils.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C669880 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;MoreSites4 @@ -34,11 +34,56 @@ using System.Runtime.CompilerServices; using Microsoft.Scripting.Generation; -using RespondToSite = System.Runtime.CompilerServices.CallSite>; - namespace IronRuby.Runtime { + public class CallSiteStorage : SiteLocalStorage> where TCallSiteFunc : class { + public CallSite/*!*/ GetCallSite(string/*!*/ methodName, int argumentCount) { + + if (Data == null) { + Interlocked.CompareExchange(ref Data, + CallSite.Create(RubyCallAction.Make(methodName, RubyCallSignature.WithImplicitSelf(argumentCount))), null); + } + return Data; + } + + public CallSite/*!*/ GetCallSite(string/*!*/ methodName, RubyCallSignature signature) { + + if (Data == null) { + Interlocked.CompareExchange(ref Data, + CallSite.Create(RubyCallAction.Make(methodName, signature)), null); + } + return Data; + } + } + + public class BinaryOpStorage : CallSiteStorage> { + public CallSite>/*!*/ GetCallSite(string/*!*/ methodName) { + return GetCallSite(methodName, 1); + } + } + + public class UnaryOpStorage : CallSiteStorage> { + public CallSite>/*!*/ GetCallSite(string/*!*/ methodName) { + return GetCallSite(methodName, 0); + } + } + + public class RespondToStorage : CallSiteStorage> { + public CallSite>/*!*/ GetCallSite() { + return GetCallSite("respond_to?", 1); + } + } + + public class ConversionStorage : CallSiteStorage> { + public CallSite>/*!*/ GetSite(RubyConversionAction/*!*/ conversion) { + if (Data == null) { + Interlocked.CompareExchange(ref Data, CallSite>.Create(conversion), null); + } + return Data; + } + } + + public static class RubyUtils { #region Objects @@ -83,7 +128,9 @@ return context.GetClassOf(self).Name; } - public static MutableString/*!*/ ObjectToMutableString(RubyContext/*!*/ context, object obj) { + public static MutableString/*!*/ InspectObject(UnaryOpStorage/*!*/ inspectStorage, ConversionStorage/*!*/ tosStorage, + RubyContext/*!*/ context, object obj) { + using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(obj)) { if (handle == null) { return MutableString.Create("..."); @@ -97,8 +144,7 @@ // Ruby prints 2*object_id for objects str.Append(':'); AppendFormatHexObjectId(str, GetObjectId(context, obj)); - - // display instance variables + RubyInstanceData data = context.TryGetInstanceData(obj); if (data != null) { var vars = data.GetInstanceVariablePairs(); @@ -112,20 +158,53 @@ } str.Append(var.Key); str.Append("="); - str.Append(RubySites.Inspect(context, var.Value)); + + var inspectSite = inspectStorage.GetCallSite("inspect"); + object inspectedValue = inspectSite.Target(inspectSite, context, var.Value); + + var tosSite = tosStorage.GetSite(ConvertToSAction.Instance); + str.Append(tosSite.Target(tosSite, context, inspectedValue)); + + str.TaintBy(var.Value, context); } } str.Append(">"); + str.TaintBy(obj, context); return str; } } + public static MutableString/*!*/ ObjectToMutableString(RubyContext/*!*/ context, object obj) { + RubyClass objClass = context.GetClassOf(obj); + MutableString str = MutableString.CreateMutable(); + str.Append("#<"); + str.Append(objClass.GetName(context)); + + // Ruby prints 2*object_id for objects + str.Append(':'); + AppendFormatHexObjectId(str, GetObjectId(context, obj)); + + str.Append(">"); + + str.TaintBy(obj, context); + return str; + } + + public static MutableString/*!*/ ObjectToMutableString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, object obj) { + var site = tosStorage.GetCallSite("to_s"); + return site.Target(site, context, obj) as MutableString ?? ObjectToMutableString(context, obj); + } + public static MutableString/*!*/ AppendFormatHexObjectId(MutableString/*!*/ str, int objectId) { return str.AppendFormat("0x{0:x7}", 2 * objectId); } - public static bool TryDuplicateObject(RubyContext/*!*/ context, object obj, bool cloneSemantics, out object copy) { + public static bool TryDuplicateObject( + CallSiteStorage>/*!*/ initializeCopyStorage, + CallSiteStorage>/*!*/ allocateStorage, + RubyContext/*!*/ context, object obj, bool cloneSemantics, out object copy) { + // Ruby value types can't be cloned if (RubyUtils.IsRubyValueType(obj)) { copy = null; @@ -137,25 +216,21 @@ copy = clonable.Duplicate(context, cloneSemantics); } else { // .NET classes and library clases that doesn't implement IDuplicable: - copy = RubySites.Allocate(context.GetClassOf(obj)); + var allocateSite = allocateStorage.GetCallSite("allocate", 0); + copy = allocateSite.Target(allocateSite, context, context.GetClassOf(obj)); + context.CopyInstanceData(obj, copy, cloneSemantics); } - // TODO: optimize - _InitializeCopySharedSite.Target(_InitializeCopySharedSite, context, copy, obj); + var initializeCopySite = initializeCopyStorage.GetCallSite("initialize_copy", 1); + initializeCopySite.Target(initializeCopySite, context, copy, obj); if (cloneSemantics) { context.FreezeObjectBy(copy, obj); } return true; - } + } - private static readonly CallSite> _InitializeCopySharedSite = - CallSite>.Create( - RubyCallAction.Make("initialize_copy", RubyCallSignature.WithImplicitSelf(1)) - ); - - #if FALSE [MultiRuntimeAware] private static RecursionTracker/*!*/ _infiniteCopyTracker = new RecursionTracker(); @@ -449,9 +524,7 @@ Assert.NotNull(context); RubyModule module = obj as RubyModule; if (module == null) { - throw RubyExceptions.CreateTypeError( - RubyUtils.ObjectToMutableString(context, obj).Append(" is not a class/module").ConvertToString() - ); + throw RubyExceptions.CreateTypeError(String.Format("{0} is not a class/module", context.GetClassOf(obj))); } return module; } @@ -766,26 +839,6 @@ #region Call Site Storage Extensions - public static CallSite/*!*/ GetCallSite(this SiteLocalStorage>/*!*/ storage, - string/*!*/ methodName, int argumentCount) where TCallSiteFunc : class { - - if (storage.Data == null) { - Interlocked.CompareExchange(ref storage.Data, - CallSite.Create(RubyCallAction.Make(methodName, RubyCallSignature.WithImplicitSelf(argumentCount))), null); - } - return storage.Data; - } - - public static CallSite/*!*/ GetCallSite(this SiteLocalStorage>/*!*/ storage, - string/*!*/ methodName, RubyCallSignature signature) where TCallSiteFunc : class { - - if (storage.Data == null) { - Interlocked.CompareExchange(ref storage.Data, - CallSite.Create(RubyCallAction.Make(methodName, signature)), null); - } - return storage.Data; - } - public static CallSite/*!*/ GetCallSite(ref CallSite/*!*/ site, string/*!*/ methodName, int argumentCount) where TCallSiteFunc : class { =================================================================== add: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/ConvertToSAction.cs File: ConvertToSAction.cs =================================================================== --- [no source file] +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/ConvertToSAction.cs;MoreSites4 @@ -1,0 +1,71 @@ +?/* **************************************************************************** + * + * Copyright (c) Microsoft Corporation. + * + * This source code is subject to terms and conditions of the Microsoft Public License. A + * copy of the license can be found in the License.html file at the root of this distribution. If + * you cannot locate the Microsoft Public License, please send an email to + * ironruby@microsoft.com. By using this source code in any fashion, you are agreeing to be bound + * by the terms of the Microsoft Public License. + * + * You must not remove this notice, or any other, from this software. + * + * + * ***************************************************************************/ + +using System; +using IronRuby.Builtins; +using IronRuby.Compiler; +using IronRuby.Compiler.Generation; +using Microsoft.Scripting.Runtime; +using AstUtils = Microsoft.Scripting.Ast.Utils; + +namespace IronRuby.Runtime.Calls { + // 1) implicit conversion to MutableString + // 2) calls to_s + // 3) default conversion if (2) returns a non-string + public sealed class ConvertToSAction : RubyConversionAction, IExpressionSerializable, IEquatable { + public static readonly ConvertToSAction Instance = new ConvertToSAction(); + + private ConvertToSAction() { + } + + [Emitted] + public static ConvertToSAction/*!*/ Make() { + return Instance; + } + + public bool Equals(ConvertToSAction other) { + return other != null; + } + + protected override void SetRule(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args) { + const string ToS = "to_s"; + + // no conversion for a subclass of string: + var stringTarget = args.Target as MutableString; + if (stringTarget != null) { + metaBuilder.AddTypeRestriction(args.Target.GetType(), args.TargetExpression); + metaBuilder.Result = AstUtils.Convert(args.TargetExpression, typeof(MutableString)); + return; + } + + // check for type, version: + metaBuilder.AddTargetTypeTest(args); + + // invoke target.to_s and if successful convert the result to string unless it is already: + RubyMemberInfo conversionMethod = args.RubyContext.ResolveMethod(args.Target, ToS, false).InvalidateSitesOnOverride(); + if (conversionMethod != null) { + conversionMethod.BuildCall(metaBuilder, args, ToS); + + if (metaBuilder.Error) { + return; + } + } else { + metaBuilder.Result = args.TargetExpression; + } + + metaBuilder.Result = Methods.ToSDefaultConversion.OpCall(args.ContextExpression, metaBuilder.Result); + } + } +} =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/ProtocolConversionAction.cs;C669565 File: ProtocolConversionAction.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/ProtocolConversionAction.cs;C669565 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/ProtocolConversionAction.cs;MoreSites4 @@ -30,12 +30,40 @@ using IronRuby.Compiler.Generation; using System.Collections; using System.Reflection; +using System.Collections.Generic; namespace IronRuby.Runtime.Calls { + public abstract class RubyConversionAction : DynamicMetaObjectBinder, IExpressionSerializable { + protected RubyConversionAction() { + } - public abstract class ProtocolConversionAction : DynamicMetaObjectBinder, IExpressionSerializable { - internal static readonly RubyCallSignature Signature = RubyCallSignature.WithScope(0); + // All protocol conversion actions ignore the current scope and use RubyContext only. + // That means if the to_xxx conversion methods or respond_to? are aliased to scope manipulating methods (e.g. eval, private, ...) + // it won't work. We assume that this is acceptable (it could be easily changed, we can define 2 kinds of protocol actions: with scope and with context). + internal static readonly RubyCallSignature Signature = RubyCallSignature.WithImplicitSelf(0); + + public override object/*!*/ CacheIdentity { + get { return this; } + } + public override DynamicMetaObject/*!*/ Bind(DynamicMetaObject/*!*/ context, DynamicMetaObject/*!*/[]/*!*/ args) { + var mo = new MetaObjectBuilder(); + SetRule(mo, new CallArguments(context, args, Signature)); + return mo.CreateMetaObject(this, context, args); + } + + Expression/*!*/ IExpressionSerializable.CreateExpression() { + return Ast.Call(GetType().GetMethod("Make")); + } + + protected abstract void SetRule(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args); + } + + // Conversion operations: + // 1) tries implicit conversions + // 2) calls respond_to? :to_xxx + // 3) calls to_xxx + public abstract class ProtocolConversionAction : RubyConversionAction, IExpressionSerializable { protected ProtocolConversionAction() { } @@ -44,6 +72,10 @@ return ConvertToStrAction.Instance; } + // TODO: combined to_str + to_int cast -> String/Fixnum (socket) + // TODO: combined to_int + to_i cast -> Fixnum/Bignum + + // TODO: nullable int (see Array#fill, Sockets:ConvertToSocketFlag) if (parameterType == typeof(int)) { return ConvertToFixnumAction.Instance; } @@ -64,33 +96,23 @@ return ConvertToArrayAction.Instance; } + if (parameterType == typeof(IDictionary)) { + return ConvertToHashAction.Instance; + } + return null; } - public override object/*!*/ CacheIdentity { - get { return this; } - } - - public override DynamicMetaObject/*!*/ Bind(DynamicMetaObject/*!*/ context, DynamicMetaObject/*!*/[]/*!*/ args) { - var mo = new MetaObjectBuilder(); - SetRule(mo, new CallArguments(context, args, Signature)); - return mo.CreateMetaObject(this, context, args); - } - - Expression/*!*/ IExpressionSerializable.CreateExpression() { - return Ast.Call(GetType().GetMethod("Make")); - } - protected abstract string/*!*/ ToMethodName { get; } protected abstract MethodInfo ConversionResultValidator { get; } protected abstract string/*!*/ TargetTypeName { get; } protected abstract bool TryImplicitConversion(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args); - internal void SetRule(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args) { + protected override void SetRule(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args) { Assert.NotNull(metaBuilder, args); Debug.Assert(args.SimpleArgumentCount == 0 && !args.Signature.HasBlock && !args.Signature.HasSplattedArgument && !args.Signature.HasRhsArgument); - Debug.Assert(args.Signature.HasScope); + Debug.Assert(!args.Signature.HasScope); var ec = args.RubyContext; @@ -139,9 +161,9 @@ // slow path: invoke respond_to?, to_xxx and result validation: var conversionCallSite = Ast.Dynamic( - RubyCallAction.Make(toMethodName, RubyCallSignature.WithScope(0)), + RubyCallAction.Make(toMethodName, RubyCallSignature.WithImplicitSelf(0)), typeof(object), - args.ScopeExpression, args.TargetExpression + args.ContextExpression, args.TargetExpression ); Expression opCall; @@ -151,9 +173,9 @@ // respond_to?() Methods.IsTrue.OpCall( Ast.Dynamic( - RubyCallAction.Make(Symbols.RespondTo, RubyCallSignature.WithScope(1)), + RubyCallAction.Make(Symbols.RespondTo, RubyCallSignature.WithImplicitSelf(1)), typeof(object), - args.ScopeExpression, args.TargetExpression, Ast.Constant(SymbolTable.StringToId(toMethodName)) + args.ContextExpression, args.TargetExpression, Ast.Constant(SymbolTable.StringToId(toMethodName)) ) ), @@ -283,6 +305,26 @@ } } + public sealed class ConvertToHashAction : ConvertToReferenceTypeAction>, IEquatable { + public static readonly ConvertToHashAction Instance = new ConvertToHashAction(); + + protected override string/*!*/ ToMethodName { get { return Symbols.ToHash; } } + protected override string/*!*/ TargetTypeName { get { return "Hash"; } } + protected override MethodInfo ConversionResultValidator { get { return Methods.ToHashValidator; } } + + private ConvertToHashAction() { + } + + [Emitted] + public static ConvertToHashAction/*!*/ Make() { + return Instance; + } + + public bool Equals(ConvertToHashAction other) { + return other != null; + } + } + public sealed class TryConvertToArrayAction : ConvertToReferenceTypeAction, IEquatable { public static readonly TryConvertToArrayAction Instance = new TryConvertToArrayAction(); @@ -303,26 +345,6 @@ } } - public sealed class ConvertToSAction : ConvertToReferenceTypeAction, IEquatable { - public static readonly ConvertToSAction Instance = new ConvertToSAction(); - - protected override string/*!*/ ToMethodName { get { return Symbols.ToS; } } - protected override string/*!*/ TargetTypeName { get { return "String"; } } - protected override MethodInfo ConversionResultValidator { get { return Methods.ToSValidator; } } - - private ConvertToSAction() { - } - - [Emitted] - public static ConvertToSAction/*!*/ Make() { - return Instance; - } - - public bool Equals(ConvertToSAction other) { - return other != null; - } - } - public sealed class ConvertToFixnumAction : ProtocolConversionAction, IEquatable { public static readonly ConvertToFixnumAction Instance = new ConvertToFixnumAction(); =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyBinder.cs;C669565 File: RubyBinder.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyBinder.cs;C669565 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyBinder.cs;MoreSites4 @@ -48,8 +48,7 @@ var i = 0; while (i < parameterInfos.Length - && parameterInfos[i].ParameterType.IsGenericType - && parameterInfos[i].ParameterType.GetGenericTypeDefinition() == typeof(SiteLocalStorage<>)) { + && parameterInfos[i].ParameterType.IsSubclassOf(typeof(SiteLocalStorage))) { arguments.Add(new SiteLocalStorageBuilder(parameterInfos[i])); i++; =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallSignature.cs;C660056 File: RubyCallSignature.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallSignature.cs;C660056 (server) 12/9/2008 3:28 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallSignature.cs;MoreSites4 @@ -38,7 +38,7 @@ HasImplicitSelf = 16, // Tries to call the method, if not successful returns a RubyOps.MethodNotFound singleton. - IsTryCall = 32 + IsTryCall = 32, } /// =================================================================== edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyParameterBinder.cs;C633889 File: RubyParameterBinder.cs =================================================================== --- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyParameterBinder.cs;C633889 (server) 12/9/2008 1:43 PM +++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyParameterBinder.cs;MoreSites4 @@ -71,7 +71,7 @@ var action = ProtocolConversionAction.TryGetConversionAction(toType); if (action != null) { // TODO: once we work with MetaObjects, we could inline these dynamic sites: - return Ast.Dynamic(action, toType, ScopeExpression, expr); + return Ast.Dynamic(action, toType, ContextExpression, expr); } throw new InvalidOperationException(String.Format("No default protocol conversion for type {0}.", toType)); ===================================================================