Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/ironruby/ironruby
Browse files Browse the repository at this point in the history
  • Loading branch information
Shri Borde committed Mar 24, 2009
2 parents 79298ef + 41219b1 commit a90a894
Show file tree
Hide file tree
Showing 64 changed files with 1,246 additions and 517 deletions.
Expand Up @@ -40,7 +40,7 @@
end

# FIXME: do not use conditionals like this around #it blocks
unless not home = ENV['HOME']
unless not home = ENV['HOME'].tr('\\', '/')
it "converts a pathname to an absolute pathname, using ~ (home) as base" do
File.expand_path('~').should == home
File.expand_path('~', '/tmp/gumby/ddd').should == home
Expand Down
2 changes: 1 addition & 1 deletion Merlin/Main/Config/Signed/App.config
Expand Up @@ -7,7 +7,7 @@
<microsoft.scripting>
<languages>
<language names="IronPython;Python;py" extensions=".py" displayName="IronPython 2.6 Alpha" type="IronPython.Runtime.PythonContext, IronPython, Version=2.6.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby 1.0 Alpha" type="IronRuby.Runtime.RubyContext, IronRuby, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby 0.3" type="IronRuby.Runtime.RubyContext, IronRuby, Version=0.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<language names="ToyScript;ts" extensions=".ts" type="ToyScript.ToyLanguageContext, ToyScript, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</languages>

Expand Down
2 changes: 1 addition & 1 deletion Merlin/Main/Config/Unsigned/App.config
Expand Up @@ -7,7 +7,7 @@
<microsoft.scripting>
<languages>
<language names="IronPython;Python;py" extensions=".py" displayName="IronPython 2.6 Alpha" type="IronPython.Runtime.PythonContext, IronPython, Version=2.6.0.1, Culture=neutral, PublicKeyToken=null" />
<language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby 1.0 Alpha" type="IronRuby.Runtime.RubyContext, IronRuby, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby 0.3" type="IronRuby.Runtime.RubyContext, IronRuby, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null" />
<language names="ToyScript;ts" extensions=".ts" type="ToyScript.ToyLanguageContext, ToyScript, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</languages>

Expand Down
Expand Up @@ -267,7 +267,7 @@ class LookupGlobalInstruction : Instruction {
_name = SymbolTable.StringToId(name);
_isLocal = isLocal;
}

public override int ConsumedStack { get { return 1; } }
public override int ProducedStack { get { return 1; } }
public override int Run(StackFrame frame) {
if (_isLocal) {
Expand Down
4 changes: 2 additions & 2 deletions Merlin/Main/Languages/IronPython/IronPython/Runtime/List.cs
Expand Up @@ -264,7 +264,7 @@ internal List(ICollection items)
n = self._size;
//??? is this useful optimization
//???if (n == 1) return new List(Array.ArrayList.Repeat(this[0], count));
newCount = n * count;
newCount = checked(n * count);
ret = ArrayOps.CopyArray(self._data, newCount);
}

Expand Down Expand Up @@ -344,7 +344,7 @@ internal List(ICollection items)
public List InPlaceMultiply(int count) {
lock (this) {
int n = this._size;
int newCount = n * count;
int newCount = checked(n * count);
EnsureSize(newCount);

int block = n;
Expand Down
Expand Up @@ -166,11 +166,8 @@ public static partial class ComplexOps {
public static object __getnewargs__(CodeContext context, Complex64 self) {
if (!Object.ReferenceEquals(self, null)) {
return PythonTuple.MakeTuple(
ComplexOps.__new__(context,
TypeCache.Complex64,
PythonOps.GetBoundAttr(context, self, Symbols.RealPart),
PythonOps.GetBoundAttr(context, self, Symbols.ImaginaryPart)
)
PythonOps.GetBoundAttr(context, self, Symbols.RealPart),
PythonOps.GetBoundAttr(context, self, Symbols.ImaginaryPart)
);
}
throw PythonOps.TypeErrorForBadInstance("__getnewargs__ requires a 'complex' object but received a '{0}'", self);
Expand Down
Expand Up @@ -59,14 +59,21 @@ public static class ScopeOps {
}
}

public static object __getattribute__(Scope/*!*/ self, string name) {
public static object __getattribute__(CodeContext/*!*/ context, Scope/*!*/ self, string name) {
switch (name) {
// never look in the dict for these...
case "__dict__": return Get__dict__(self);
case "__class__": return DynamicHelpers.GetPythonType(self);
}

SymbolId si = SymbolTable.StringToId(name);
object res;
if (self.TryGetName(si, out res)) {
return res;
}

throw PythonOps.AttributeErrorForMissingAttribute("module", si);
// fall back to object to provide all of our other attributes (e.g. __setattr__, etc...)
return ObjectOps.__getattribute__(context, self, name);
}

public static void __setattr__(Scope/*!*/ self, string name, object value) {
Expand Down
Expand Up @@ -179,7 +179,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return FastNew(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -197,7 +197,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return FastNew(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -206,7 +206,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return CheckAsciiString(context, ScriptingRuntimeHelpers.CharToString(@object));
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -215,7 +215,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return @object.ToString();
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -224,7 +224,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return FastNew(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -233,7 +233,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return @object.ToString();
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -242,7 +242,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return @object.ToString();
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -251,7 +251,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return DoubleOps.__str__(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -260,7 +260,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return FastNew(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -269,7 +269,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return SingleOps.__str__(context, @object);
} else {
return cls.CreateInstance(context, @object);
return cls.CreateInstance(context, __new__(context, TypeCache.String, @object));
}
}

Expand All @@ -285,7 +285,7 @@ public static class StringOps {
if (cls == TypeCache.String) {
return decode(context, str, encoding ?? PythonContext.GetContext(context).GetDefaultEncodingName(), errors);
} else {
return cls.CreateInstance(context, str, encoding, errors);
return cls.CreateInstance(context, __new__(context, TypeCache.String, str, encoding, errors));
}
}

Expand Down

0 comments on commit a90a894

Please sign in to comment.