Hi,
http://github.com/nrk/ironruby/commit/4afc7f1bc44b007a9dca30e6330eca35d487f165
This commit resolves the following failing specs:
Array#<=> properly handles recursive arrays (critical)
Array#initialize with (size, object=nil) uses the block value instead
of using the default value
Array#to_a does not return subclass instance on Array subclasses
Array#uniq! raises a TypeError on a frozen array if modification would
take place
Array#values_at returns an array of elements in the ranges when passes ranges
>From the commit message:
* Removed unused allocateStorage argument from IListOps.First and
IListOps.Last; Removed the manual protocol conversion bits in
IListOps.Fetch
* Fix IoOps.ToPrintedString to output a double converted to string
using an invariant culture (Issue #597 NumericLiterals1 test fails
under french culture)
* IListOps.ValuesAt adds a null value to the result if the begin value
of the specified range instance(s) is <= the length of the array and
the end value is >= the length of the array.
* Array#uniq! raises a TypeError on a frozen array if modification
would take place.
* Fixed ArrayOps.ToArray to return a new RubyArray instance with the
elements of self if self is a RubyArray.Subclass.
* Array#initialize with (size, object=nil) uses the block value
instead of using the default value
* Fixed IListOps.Compare to work with recursive arrays.
A diff is attached to this mail.
PS: This completes my previous commit by removing unused
allocateStorage arguments from IListOps.First and IListOps.Last.
Thanks,
Daniele
--
Daniele Alessandri
http://www.clorophilla.net/blog/
http://twitter.com/JoL1hAHN
-------------- next part --------------
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/comparison_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/comparison_tags.txt
deleted file mode 100644
index d0121c0..0000000
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/comparison_tags.txt
+++ /dev/null
@@ -1 +0,0 @@
-critical:Array#<=> properly handles recursive arrays
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/initialize_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/initialize_tags.txt
index 35d6855..1177323 100644
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/initialize_tags.txt
+++
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/initialize_tags.txt
@@ -1,2 +1 @@
fails:Array#initialize with (size, object=nil) raises an ArgumentError if size
is too large
-fails:Array#initialize with (size, object=nil) uses the block value instead of
using the default value
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/to_a_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/to_a_tags.txt
deleted file mode 100644
index 9bf9c4a..0000000
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/to_a_tags.txt
+++ /dev/null
@@ -1 +0,0 @@
-fails:Array#to_a does not return subclass instance on Array subclasses
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/uniq_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/uniq_tags.txt
index f6f226d..8cad6e1 100644
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/uniq_tags.txt
+++
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/uniq_tags.txt
@@ -1,3 +1,2 @@
critical:Array#uniq properly handles recursive arrays
critical:Array#uniq! properly handles recursive arrays
-fails:Array#uniq! raises a TypeError on a frozen array if modification would
take place
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/values_at_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/values_at_tags.txt
deleted file mode 100644
index 96856f9..0000000
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/core/array/values_at_tags.txt
+++ /dev/null
@@ -1 +0,0 @@
-fails:Array#values_at returns an array of elements in the ranges when passes
ranges
diff --git
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/critical_tags.txt
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/critical_tags.txt
index ea9f7cf..4ecf865 100644
---
a/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/critical_tags.txt
+++
b/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/critical_tags.txt
@@ -4,31 +4,30 @@ core\argf\eof_tags.txt:0:critical:ARGF.eof returns true when
reaching the end of
core\argf\file_tags.txt:0:critical:ARGF.file returns the current file object on
each file
core\argf\filename_tags.txt:0:critical:ARGF.filename returns the current file
name on each file
core\argf\filename_tags.txt:0:critical:ARGF.filename it sets the $FILENAME
global variable with the current file name on each file
core\argf\fileno_tags.txt:0:critical:ARGF.fileno returns the current file
number on each file
core\argf\gets_tags.txt:0:critical:ARGF.gets reads one line of a file
core\argf\gets_tags.txt:0:critical:ARGF.gets reads all lines of a file
core\argf\gets_tags.txt:0:critical:ARGF.gets reads all lines of two files
core\argf\gets_tags.txt:0:critical:ARGF.gets returns nil when reaching end of
files
core\argf\gets_tags.txt:0:critical:ARGF.gets sets $_ global variable with each
line read
core\argf\lineno_tags.txt:0:critical:ARGF.lineno returns the current line
number on each file
core\argf\path_tags.txt:0:critical:ARGF.path returns the current file name on
each file
core\argf\path_tags.txt:0:critical:ARGF.path it sets the $FILENAME global
variable with the current file name on each file
core\argf\rewind_tags.txt:0:critical:ARGF.rewind goes back to beginning of
current file
core\argf\to_i_tags.txt:0:critical:ARGF.to_i returns the current file number on
each file
core\argf\to_io_tags.txt:0:critical:ARGF.to_io returns the IO of the current
file
-core\array\comparison_tags.txt:0:critical:Array#<=> properly handles
recursive arrays
core\array\eql_tags.txt:0:critical:Array#eql? properly handles recursive arrays
core\array\equal_value_tags.txt:0:critical:Array#== properly handles recursive
arrays
core\array\hash_tags.txt:0:critical:Array#hash properly handles recursive
arrays
core\array\hash_tags.txt:0:critical:Array#hash properly handles recursive
arrays
core\array\intersection_tags.txt:0:critical:Array#& properly handles
recursive arrays
core\array\join_tags.txt:0:critical:Array#join raises a NoMethodError if an
element does not respond to #to_s
core\array\join_tags.txt:0:critical:Array#join does not separates elements when
the passed separator is nil
core\array\union_tags.txt:0:critical:Array#| properly handles recursive arrays
core\array\uniq_tags.txt:0:critical:Array#uniq properly handles recursive
arrays
core\array\uniq_tags.txt:0:critical:Array#uniq! properly handles recursive
arrays
core\kernel\sleep_tags.txt:3:critical:Kernel#sleep pauses execution
indefinitely if not given a duration
core\process\times_tags.txt:0:unstable:Process.times returns current cpu times
core\string\process\wait_tags.txt:0:critical:Process.wait
core\string\process\wait2_tags.txt:0:critical:Process.wait2
core\string\process\waitall_tags.txt:0:critical:Process.waitall
diff --git
a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs
b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs
index 10fb9ec..8b72440 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ArrayOps.cs
@@ -94,30 +94,42 @@ namespace IronRuby.Builtins {
}
private static RubyArray/*!*/ Reinitialize(RubyArray/*!*/ self,
IList/*!*/ other) {
Assert.NotNull(self, other);
if (other != self) {
self.Clear();
IListOps.AddRange(self, other);
}
return self;
}
private static object CreateArray(BlockParam/*!*/ block, int size) {
return Reinitialize(block, new RubyArray(), size);
}
+ [RubyConstructor]
+ public static RubyArray/*!*/ CreateArray(BlockParam/*!*/ block,
RubyClass/*!*/ self, [DefaultProtocol]int size, object value) {
+ return Reinitialize(block, new RubyArray(), size, value);
+ }
+
+ [RubyMethod("initialize",
RubyMethodAttributes.PrivateInstance)]
+ public static RubyArray/*!*/ Reinitialize(BlockParam/*!*/ block,
RubyArray/*!*/ self, int size, object value) {
+ block.RubyContext.ReportWarning("block supersedes default
value argument");
+ Reinitialize(block, self, size);
+ return self;
+ }
+
private static object Reinitialize(BlockParam/*!*/ block,
RubyArray/*!*/ self, int size) {
if (size < 0) {
throw RubyExceptions.CreateArgumentError("negative array
size");
}
self.Clear();
for (int i = 0; i < size; i++) {
object item;
if (block.Yield(i, out item)) {
return item;
}
self.Add(item);
}
return self;
@@ -149,31 +161,31 @@ namespace IronRuby.Builtins {
[RubyMethod("[]", RubyMethodAttributes.PublicSingleton)]
public static RubyArray/*!*/ MakeArray(RubyClass/*!*/ self, params
object[] args) {
// neither "new" nor "initialize" is called:
RubyArray result = RubyArray.CreateInstance(self);
foreach (object obj in args) {
result.Add(obj);
}
return result;
}
#endregion
[RubyMethod("to_a")]
[RubyMethod("to_ary")]
public static RubyArray/*!*/ ToArray(RubyArray/*!*/ self) {
- return self;
+ return self is RubyArray.Subclass ? new RubyArray(self) : self;
}
#region class FormatDirective is used by Array.pack and String.unpack
internal struct FormatDirective {
internal readonly char Directive;
internal readonly int? Count;
private static readonly Dictionary<char, char> _native;
static FormatDirective() {
bool is64bit = (IntPtr.Size == 8);
_native = new Dictionary<char, char>(6);
_native[''s''] = ''s'';
_native[''S''] = ''S'';
_native[''i''] = ''i'';
diff --git
a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs
b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs
index 6da6a3d..0d18961 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs
@@ -616,32 +616,33 @@ namespace IronRuby.Builtins {
public static MutableString/*!*/
ToPrintedString(ConversionStorage<MutableString>/*!*/ tosConversion,
object obj) {
IDictionary<object, object> hash;
List<object> list;
MutableString str;
if ((list = obj as List<object>) != null) {
return IListOps.Join(tosConversion, list, NewLine);
} else if ((hash = obj as IDictionary<object, object>) !=
null) {
return IDictionaryOps.ToMutableString(tosConversion, hash);
} else if (obj == null) {
return MutableString.Create("nil");
} else if (obj is bool) {
return MutableString.Create((bool)obj ? "true" :
"false");
} else if (obj is double) {
- var result = MutableString.Create(obj.ToString());
- if ((double)(int)(double)obj == (double)obj) {
+ double value = (double)obj;
+ var result =
MutableString.Create(value.ToString(System.Globalization.CultureInfo.InvariantCulture));
+ if ((double)(int)value == value) {
result.Append(".0");
}
return result;
} else if ((str = obj as MutableString) != null) {
return str;
} else {
return Protocols.ConvertToString(tosConversion, obj);
}
}
[RubyMethod("puts")]
public static void PutsEmptyLine(BinaryOpStorage/*!*/ writeStorage,
object self) {
Protocols.Write(writeStorage, self,
MutableString.CreateMutable("\n"));
}
diff --git
a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
index f6a6fd8..8dd37de 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
@@ -261,44 +261,52 @@ namespace IronRuby.Builtins {
}
if (self.Count != other.Count) {
return false;
}
for (int i = 0; i < self.Count; ++i) {
bool result = Protocols.IsEqual(equals, self[i], other[i]);
if (!result) {
return false;
}
}
return true;
}
+ [MultiRuntimeAware]
+ private static RubyUtils.RecursionTracker _infiniteComparisonTracker =
new RubyUtils.RecursionTracker();
+
[RubyMethod("<=>")]
public static object Compare(BinaryOpStorage/*!*/ comparisonStorage,
IList/*!*/ self, [DefaultProtocol, NotNull]IList/*!*/ other) {
+ using (IDisposable handle =
_infiniteComparisonTracker.TrackObject(self)) {
+ if (handle == null) {
+ return 0;
+ }
- int limit = Math.Min(self.Count, other.Count);
- var compare = comparisonStorage.GetCallSite("<=>");
+ int limit = Math.Min(self.Count, other.Count);
+ var compare =
comparisonStorage.GetCallSite("<=>");
- for (int i = 0; i < limit; i++) {
- object result = compare.Target(compare, self[i], other[i]);
- if (!(result is int) || (int)result != 0) {
- return result;
+ for (int i = 0; i < limit; i++) {
+ object result = compare.Target(compare, self[i], other[i]);
+ if (!(result is int) || (int)result != 0) {
+ return result;
+ }
}
- }
- return ScriptingRuntimeHelpers.Int32ToObject(Math.Sign(self.Count -
other.Count));
+ return
ScriptingRuntimeHelpers.Int32ToObject(Math.Sign(self.Count - other.Count));
+ }
}
[RubyMethod("eql?")]
public static bool HashEquals(IList/*!*/ self, object other) {
return RubyArray.Equals(self, other);
}
[RubyMethod("hash")]
public static int GetHashCode(IList/*!*/ self) {
return RubyArray.GetHashCode(self);
}
#endregion
#region slice, [], at
@@ -723,51 +731,45 @@ namespace IronRuby.Builtins {
if (block.Yield(i, out result)) {
return result;
}
i++;
}
return self;
}
#endregion
#region fetch
[RubyMethod("fetch")]
public static object Fetch(
- RespondToStorage/*!*/ respondToStorage,
- CallSiteStorage<Func<CallSite, object, int>>/*!*/
toIntStorage,
+ ConversionStorage<int>/*!*/ fixnumCast,
BlockParam outOfRangeValueProvider,
IList/*!*/ list,
object/*!*/ index,
[Optional]object defaultValue) {
- if (!Protocols.RespondTo(respondToStorage, index,
"to_int")) {
- throw
RubyExceptions.CannotConvertTypeToTargetType(respondToStorage.Context, index,
"Integer");
- }
-
- var toInt = toIntStorage.GetCallSite("to_int", 0);
- int convertedIndex = toInt.Target(toInt, index);
+ int convertedIndex = Protocols.CastToFixnum(fixnumCast, index);
if (InRangeNormalized(list, ref convertedIndex)) {
return list[convertedIndex];
}
if (outOfRangeValueProvider != null) {
if (defaultValue != Missing.Value) {
- respondToStorage.Context.ReportWarning("block
supersedes default value argument");
+ fixnumCast.Context.ReportWarning("block supersedes
default value argument");
}
object result;
outOfRangeValueProvider.Yield(index, out result);
return result;
}
if (defaultValue == Missing.Value) {
throw RubyExceptions.CreateIndexError("index " +
convertedIndex + " out of array");
}
return defaultValue;
}
#endregion
@@ -875,48 +877,46 @@ namespace IronRuby.Builtins {
int length = Math.Max(0, end - begin + (range.ExcludeEnd ? 0 : 1));
return Fill(fixnumCast.Context, block, self, begin, length);
}
#endregion
#region first, last
[RubyMethod("first")]
public static object First(IList/*!*/ self) {
return self.Count == 0 ? null : self[0];
}
[RubyMethod("first")]
- public static IList/*!*/ First(CallSiteStorage<Func<CallSite,
RubyClass, object>>/*!*/ allocateStorage,
- IList/*!*/ self, [DefaultProtocol]int count) {
+ public static IList/*!*/ First(IList/*!*/ self, [DefaultProtocol]int
count) {
if (count < 0) {
throw RubyExceptions.CreateArgumentError("negative array
size (or size too big)");
}
count = count > self.Count ? self.Count : count;
return RubyArray.Create(self as IList<object>, 0, count);
}
[RubyMethod("last")]
public static object Last(IList/*!*/ self) {
return self.Count == 0 ? null : self[self.Count - 1];
}
[RubyMethod("last")]
- public static IList/*!*/ Last(CallSiteStorage<Func<CallSite,
RubyClass, object>>/*!*/ allocateStorage,
- IList/*!*/ self, [DefaultProtocol]int count) {
+ public static IList/*!*/ Last(IList/*!*/ self, [DefaultProtocol]int
count) {
if (count < 0) {
throw RubyExceptions.CreateArgumentError("negative array
size (or size too big)");
}
count = count > self.Count ? self.Count : count;
return RubyArray.Create(self as IList<object>, self.Count -
count, count);
}
#endregion
#region flatten, flatten!
[MultiRuntimeAware]
private static RubyUtils.RecursionTracker _infiniteFlattenTracker = new
RubyUtils.RecursionTracker();
@@ -1033,33 +1033,40 @@ namespace IronRuby.Builtins {
}
return result;
}
[RubyMethod("values_at")]
public static RubyArray/*!*/ ValuesAt(ConversionStorage<int>/*!*/
fixnumCast,
CallSiteStorage<Func<CallSite, RubyClass, object>>/*!*/
allocateStorage,
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(fixnumCast, allocateStorage,
self, range);
- if (fragment != null) {
- result.AddRange(fragment);
+ int start, count;
+ if (!NormalizeRange(fixnumCast, self.Count, range, out
start, out count)) {
+ continue;
+ }
+
+ if (count > 0) {
+ result.AddRange(GetElements(allocateStorage, self,
start, count));
+ if (start + count >= self.Count) {
+ result.Add(null);
+ }
}
} else {
result.Add(GetElement(self,
Protocols.CastToFixnum(fixnumCast, values[i])));
}
}
return result;
}
#endregion
#region join, to_s, inspect
public static void
RecursiveJoin(ConversionStorage<MutableString>/*!*/ tosConversion,
IList/*!*/ list, MutableString/*!*/ separator, MutableString/*!*/
result, Dictionary<object, bool>/*!*/ seen) {
@@ -1381,34 +1388,38 @@ namespace IronRuby.Builtins {
var seen = new Dictionary<object,
bool>(allocateStorage.Context.EqualityComparer);
foreach (object item in self) {
if (!seen.ContainsKey(item)) {
result.Add(item);
seen.Add(item, true);
}
}
return result;
}
[RubyMethod("uniq!")]
public static IList UniqueSelf(RubyContext/*!*/ context, IList/*!*/
self) {
var seen = new Dictionary<object,
bool>(context.EqualityComparer);
+ bool frozen = context.IsObjectFrozen(self);
bool modified = false;
int i = 0;
while (i < self.Count) {
object key = self[i];
if (!seen.ContainsKey(key)) {
seen.Add(key, true);
i++;
} else {
+ if (frozen) {
+ throw
RubyExceptions.CreateTypeError("can''t modify frozen array");
+ }
self.RemoveAt(i);
modified = true;
}
}
return modified ? self : null;
}
#endregion
}
}
diff --git
a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs
b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs
index 213c2b2..f7538a4 100644
---
a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs
+++
b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs
@@ -87,30 +87,31 @@ namespace IronRuby.Builtins {
new System.Func<IronRuby.Builtins.RubyClass, System.String,
System.Char>(IronRuby.Builtins.CharOps.Create),
new System.Func<IronRuby.Builtins.RubyClass,
IronRuby.Builtins.MutableString,
System.Char>(IronRuby.Builtins.CharOps.Create)
);
ExtendModule(typeof(System.Collections.Generic.IDictionary<System.Object,
System.Object>), LoadSystem__Collections__Generic__IDictionary_Instance,
null, null, def29);
ExtendModule(typeof(System.Collections.IEnumerable),
LoadSystem__Collections__IEnumerable_Instance, null, null, def29);
ExtendModule(typeof(System.Collections.IList),
LoadSystem__Collections__IList_Instance, null, null, def29);
ExtendModule(typeof(System.IComparable),
LoadSystem__IComparable_Instance, null, null, def38);
ExtendClass(typeof(System.String), null, null, null, null, new
IronRuby.Builtins.RubyModule[] {def6, def29, def38},
new System.Func<IronRuby.Builtins.RubyClass,
IronRuby.Builtins.MutableString,
System.String>(IronRuby.Builtins.ClrStringOps.Create),
new System.Func<IronRuby.Builtins.RubyClass, System.Char,
System.Int32, System.String>(IronRuby.Builtins.ClrStringOps.Create),
new System.Func<IronRuby.Builtins.RubyClass, System.Char[],
System.String>(IronRuby.Builtins.ClrStringOps.Create)
);
DefineGlobalClass("Array",
typeof(IronRuby.Builtins.RubyArray), false, Context.ObjectClass,
LoadArray_Instance, LoadArray_Class, null, new IronRuby.Builtins.RubyModule[]
{def29},
new System.Func<IronRuby.Builtins.RubyClass,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.CreateArray),
new
System.Func<IronRuby.Runtime.ConversionStorage<IronRuby.Runtime.Union<System.Collections.IList,
System.Int32>>, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyClass,
System.Object, System.Object>(IronRuby.Builtins.ArrayOps.CreateArray),
+ new System.Func<IronRuby.Runtime.BlockParam,
IronRuby.Builtins.RubyClass, System.Int32, System.Object,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.CreateArray),
new System.Func<IronRuby.Builtins.RubyClass, System.Int32,
System.Object,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.CreateArray)
);
DefineGlobalClass("Binding",
typeof(IronRuby.Builtins.Binding), false, Context.ObjectClass, null, null, null,
IronRuby.Builtins.RubyModule.EmptyArray);
DefineGlobalClass("Dir",
typeof(IronRuby.Builtins.RubyDir), true, Context.ObjectClass, LoadDir_Instance,
LoadDir_Class, null, new IronRuby.Builtins.RubyModule[] {def29});
#if !SILVERLIGHT
if (Context.RubyOptions.Compatibility >=
RubyCompatibility.Ruby19) {
DefineGlobalClass("Encoding",
typeof(IronRuby.Builtins.RubyEncoding), false, Context.ObjectClass,
LoadEncoding_Instance, LoadEncoding_Class, null,
IronRuby.Builtins.RubyModule.EmptyArray);
}
#endif
IronRuby.Builtins.RubyClass def39 = Context.ExceptionClass =
DefineGlobalClass("Exception", typeof(System.Exception), false,
Context.ObjectClass, LoadException_Instance, LoadException_Class, null,
IronRuby.Builtins.RubyModule.EmptyArray,
new System.Func<IronRuby.Builtins.RubyClass, System.Object,
System.Exception>(BuiltinsLibraryInitializer.ExceptionFactory__Exception));
Context.FalseClass = DefineGlobalClass("FalseClass",
typeof(IronRuby.Builtins.FalseClass), true, Context.ObjectClass,
LoadFalseClass_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
#if !SILVERLIGHT
IronRuby.Builtins.RubyClass def28 =
DefineClass("File::Stat", typeof(System.IO.FileSystemInfo), false,
Context.ObjectClass, LoadFile__Stat_Instance, null, null, new
IronRuby.Builtins.RubyModule[] {def38},
new System.Func<IronRuby.Builtins.RubyClass,
IronRuby.Builtins.MutableString,
System.IO.FileSystemInfo>(IronRuby.Builtins.RubyFileOps.RubyStatOps.Create)
@@ -387,30 +388,31 @@ namespace IronRuby.Builtins {
new System.Func<IronRuby.Runtime.RubyContext, System.Object,
IronRuby.Builtins.MutableString>(IronRuby.Builtins.ArgFilesSingletonOps.GetCurrentFileName)
);
}
#endif
private static void
LoadArgumentError_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
module.HideMethod("message");
}
private static void
LoadArray_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
LoadSystem__Collections__IList_Instance(module);
module.DefineLibraryMethod("initialize", 0x52,
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Builtins.RubyArray,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.Reinitialize),
new
System.Func<IronRuby.Runtime.ConversionStorage<IronRuby.Runtime.Union<System.Collections.IList,
System.Int32>>, IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyArray,
System.Object, System.Object>(IronRuby.Builtins.ArrayOps.Reinitialize),
+ new System.Func<IronRuby.Runtime.BlockParam,
IronRuby.Builtins.RubyArray, System.Int32, System.Object,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.Reinitialize),
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Builtins.RubyArray, System.Int32, System.Object,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.ReinitializeByRepeatedValue)
);
module.DefineLibraryMethod("pack", 0x51,
new
System.Func<IronRuby.Runtime.ConversionStorage<IronRuby.Runtime.IntegerValue>,
IronRuby.Runtime.ConversionStorage<IronRuby.Builtins.MutableString>,
IronRuby.Runtime.RubyContext, IronRuby.Builtins.RubyArray,
IronRuby.Builtins.MutableString,
IronRuby.Builtins.MutableString>(IronRuby.Builtins.ArrayOps.Pack)
);
module.DefineLibraryMethod("reverse!", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Builtins.RubyArray,
IronRuby.Builtins.RubyArray>(IronRuby.Builtins.ArrayOps.InPlaceReverse)
);
module.DefineLibraryMethod("reverse_each", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Runtime.BlockParam, IronRuby.Builtins.RubyArray,
System.Object>(IronRuby.Builtins.ArrayOps.ReverseEach)
);
@@ -5059,47 +5061,47 @@ namespace IronRuby.Builtins {
);
module.DefineLibraryMethod("each_index", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Runtime.BlockParam, System.Collections.IList,
System.Object>(IronRuby.Builtins.IListOps.EachIndex)
);
module.DefineLibraryMethod("empty?", 0x51,
new System.Func<System.Collections.IList,
System.Boolean>(IronRuby.Builtins.IListOps.Empty)
);
module.DefineLibraryMethod("eql?", 0x51,
new System.Func<System.Collections.IList, System.Object,
System.Boolean>(IronRuby.Builtins.IListOps.HashEquals)
);
module.DefineLibraryMethod("fetch", 0x51,
- new System.Func<IronRuby.Runtime.RespondToStorage,
IronRuby.Runtime.CallSiteStorage<System.Func<System.Runtime.CompilerServices.CallSite,
System.Object, System.Int32>>, IronRuby.Runtime.BlockParam,
System.Collections.IList, System.Object, System.Object,
System.Object>(IronRuby.Builtins.IListOps.Fetch)
+ new
System.Func<IronRuby.Runtime.ConversionStorage<System.Int32>,
IronRuby.Runtime.BlockParam, System.Collections.IList, System.Object,
System.Object, System.Object>(IronRuby.Builtins.IListOps.Fetch)
);
module.DefineLibraryMethod("fill", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
System.Collections.IList, System.Object, System.Int32,
System.Collections.IList>(IronRuby.Builtins.IListOps.Fill),
new System.Func<IronRuby.Runtime.RubyContext,
System.Collections.IList, System.Object, System.Int32, System.Int32,
System.Collections.IList>(IronRuby.Builtins.IListOps.Fill),
new
System.Func<IronRuby.Runtime.ConversionStorage<System.Int32>,
System.Collections.IList, System.Object, System.Object, System.Object,
System.Collections.IList>(IronRuby.Builtins.IListOps.Fill),
new
System.Func<IronRuby.Runtime.ConversionStorage<System.Int32>,
System.Collections.IList, System.Object, IronRuby.Builtins.Range,
System.Collections.IList>(IronRuby.Builtins.IListOps.Fill),
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Runtime.BlockParam, System.Collections.IList, System.Int32,
System.Object>(IronRuby.Builtins.IListOps.Fill),
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Runtime.BlockParam, System.Collections.IList, System.Int32,
System.Int32, System.Object>(IronRuby.Builtins.IListOps.Fill),
new
System.Func<IronRuby.Runtime.ConversionStorage<System.Int32>,
IronRuby.Runtime.BlockParam, System.Collections.IList, System.Object,
System.Object, System.Object>(IronRuby.Builtins.IListOps.Fill),
new
System.Func<IronRuby.Runtime.ConversionStorage<System.Int32>,
IronRuby.Runtime.BlockParam, System.Collections.IList, IronRuby.Builtins.Range,
System.Object>(IronRuby.Builtins.IListOps.Fill)
);
module.DefineLibraryMethod("first", 0x51,
new System.Func<System.Collections.IList,
System.Object>(IronRuby.Builtins.IListOps.First),
- new
System.Func<IronRuby.Runtime.CallSiteStorage<System.Func<System.Runtime.CompilerServices.CallSite,
IronRuby.Builtins.RubyClass, System.Object>>, System.Collections.IList,
System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.First)
+ new System.Func<System.Collections.IList, System.Int32,
System.Collections.IList>(IronRuby.Builtins.IListOps.First)
);
module.DefineLibraryMethod("flatten", 0x51,
new
System.Func<IronRuby.Runtime.CallSiteStorage<System.Func<System.Runtime.CompilerServices.CallSite,
IronRuby.Builtins.RubyClass, System.Object>>,
IronRuby.Runtime.ConversionStorage<System.Collections.IList>,
IronRuby.Runtime.RubyContext, System.Collections.IList,
System.Collections.IList>(IronRuby.Builtins.IListOps.Flatten)
);
module.DefineLibraryMethod("flatten!", 0x51,
new
System.Func<IronRuby.Runtime.CallSiteStorage<System.Func<System.Runtime.CompilerServices.CallSite,
IronRuby.Builtins.RubyClass, System.Object>>,
IronRuby.Runtime.ConversionStorage<System.Collections.IList>,
IronRuby.Runtime.RubyContext, System.Collections.IList,
System.Collections.IList>(IronRuby.Builtins.IListOps.FlattenInPlace)
);
module.DefineLibraryMethod("hash", 0x51,
new System.Func<System.Collections.IList,
System.Int32>(IronRuby.Builtins.IListOps.GetHashCode)
);
module.DefineLibraryMethod("include?", 0x51,
@@ -5125,31 +5127,31 @@ namespace IronRuby.Builtins {
module.DefineLibraryMethod("insert", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
System.Collections.IList, System.Int32, System.Object[],
System.Collections.IList>(IronRuby.Builtins.IListOps.Insert)
);
module.DefineLibraryMethod("inspect", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
System.Collections.IList,
IronRuby.Builtins.MutableString>(IronRuby.Builtins.IListOps.Inspect)
);
module.DefineLibraryMethod("join", 0x51,
new
System.Func<IronRuby.Runtime.ConversionStorage<IronRuby.Builtins.MutableString>,
System.Collections.IList,
IronRuby.Builtins.MutableString>(IronRuby.Builtins.IListOps.Join),
new
System.Func<IronRuby.Runtime.ConversionStorage<IronRuby.Builtins.MutableString>,
System.Collections.IList, IronRuby.Builtins.MutableString,
IronRuby.Builtins.MutableString>(IronRuby.Builtins.IListOps.Join)
);
module.DefineLibraryMethod("last", 0x51,
new System.Func<System.Collections.IList,
System.Object>(IronRuby.Builtins.IListOps.Last),
- new
System.Func<IronRuby.Runtime.CallSiteStorage<System.Func<System.Runtime.CompilerServices.CallSite,
IronRuby.Builtins.RubyClass, System.Object>>, System.Collections.IList,
System.Int32, System.Collections.IList>(IronRuby.Builtins.IListOps.Last)
+ new System.Func<System.Collections.IList, System.Int32,
System.Collections.IList>(IronRuby.Builtins.IListOps.Last)
);
module.DefineLibraryMethod("length", 0x51,
new System.Func<System.Collections.IList,
System.Int32>(IronRuby.Builtins.IListOps.Length)
);
module.DefineLibraryMethod("map!", 0x51,
new System.Func<IronRuby.Runtime.RubyContext,
IronRuby.Runtime.BlockParam, System.Collections.IList,
System.Object>(IronRuby.Builtins.IListOps.CollectInPlace)
);
module.DefineLibraryMethod("nitems", 0x51,
new System.Func<System.Collections.IList,
System.Int32>(IronRuby.Builtins.IListOps.NumberOfNonNilItems)
);
module.DefineLibraryMethod("pop", 0x51,