Permalink
Browse files

Win8 changes

  • Loading branch information...
1 parent 083128b commit 4960eb5ff6132e4b950230a6158bba3026ad2d5f @tmat tmat committed Mar 12, 2012
Showing with 2,246 additions and 2,218 deletions.
  1. +1 −1 Languages/IronPython/IronPython/Compiler/ClosureExpression.cs
  2. +3 −3 Languages/IronPython/IronPython/IronPython.csproj
  3. +2 −1 Languages/IronPython/IronPython/Modules/imp.cs
  4. +1 −1 Languages/IronPython/IronPython/Resources.Designer.cs
  5. +1 −1 Languages/IronPython/IronPython/Runtime/Binding/MetaOldClass.cs
  6. +1 −1 Languages/IronPython/IronPython/Runtime/Binding/MetaOldInstance.cs
  7. +2 −2 Languages/IronPython/IronPython/Runtime/Binding/MetaPythonObject.cs
  8. +2 −2 Languages/IronPython/IronPython/Runtime/Binding/MetaPythonType.Members.cs
  9. +11 −11 Languages/IronPython/IronPython/Runtime/Binding/MetaUserObject.Members.cs
  10. +2 −2 Languages/IronPython/IronPython/Runtime/Binding/PythonBinder.Create.cs
  11. +14 −13 Languages/IronPython/IronPython/Runtime/Binding/PythonBinder.cs
  12. +1 −1 Languages/IronPython/IronPython/Runtime/Binding/PythonOverloadResolver.cs
  13. +1 −1 Languages/IronPython/IronPython/Runtime/Binding/PythonProtocol.cs
  14. +14 −10 Languages/IronPython/IronPython/Runtime/Exceptions/PythonExceptions.cs
  15. +2 −2 Languages/IronPython/IronPython/Runtime/Operations/InstanceOps.cs
  16. +9 −9 Languages/IronPython/IronPython/Runtime/Operations/PythonTypeOps.cs
  17. +2 −2 Languages/IronPython/IronPython/Runtime/Types/BuiltinFunction.cs
  18. +11 −12 Languages/IronPython/IronPython/Runtime/Types/DocBuilder.cs
  19. +1 −1 Languages/IronPython/IronPython/Runtime/Types/NameConverter.cs
  20. +4 −3 Languages/IronPython/IronPython/Runtime/Types/NewTypeInfo.cs
  21. +3 −3 Languages/IronPython/IronPython/Runtime/Types/NewTypeMaker.cs
  22. +2 −2 Languages/IronPython/IronPython/Runtime/Types/PythonType.Generated.cs
  23. +9 −9 Languages/IronPython/IronPython/Runtime/Types/PythonType.cs
  24. +1 −1 Languages/IronPython/IronPython/Runtime/Types/{TypeInfo.Generated.cs → PythonTypeInfo.Generated.cs}
  25. +2,114 −2,114 Languages/IronPython/IronPython/Runtime/Types/{TypeInfo.cs → PythonTypeInfo.cs}
  26. +23 −1 Runtime/Microsoft.Dynamic/Utils/ExceptionUtils.cs
  27. +9 −9 Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs
@@ -200,7 +200,7 @@ class MakeClosureCellInstruction : Instruction {
public Expression/*!*/ Delete() {
return Expression.Assign(
Expression.Field(_closureCell, _cellField),
- Expression.Field(null, typeof(Uninitialized).GetField("Instance"))
+ Expression.Field(null, typeof(Uninitialized).GetDeclaredField("Instance"))
);
}
@@ -427,8 +427,8 @@
<Compile Include="Runtime\Types\ReflectedSlotProperty.cs" />
<Compile Include="Runtime\Types\StaticUnderlyingSystemType.cs" />
<Compile Include="Runtime\Types\TypeCache.Generated.cs" />
- <Compile Include="Runtime\Types\TypeInfo.cs" />
- <Compile Include="Runtime\Types\TypeInfo.Generated.cs" />
+ <Compile Include="Runtime\Types\PythonTypeInfo.cs" />
+ <Compile Include="Runtime\Types\PythonTypeInfo.Generated.cs" />
<Compile Include="Runtime\Types\BuiltinFunction.cs" />
<Compile Include="Runtime\Types\BuiltinMethodDescriptor.cs" />
<Compile Include="Runtime\Types\ConstructorFunction.cs" />
@@ -538,4 +538,4 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)Versioning.targets" />
<Target Name="BeforeBuild" DependsOnTargets="GenerateBuildInfo;GenerateCurrentVersion" />
-</Project>
+</Project>
@@ -16,6 +16,7 @@
using System;
using System.Diagnostics;
using System.IO;
+using System.Reflection;
using System.Runtime.CompilerServices;
using Microsoft.Scripting;
@@ -163,7 +164,7 @@ public static class PythonImport {
if (name == null) throw PythonOps.TypeError("is_builtin() argument 1 must be string, not None");
Type ty;
if (PythonContext.GetContext(context).BuiltinModules.TryGetValue(name, out ty)) {
- if (ty.Assembly == typeof(PythonContext).Assembly) {
+ if (ty.GetTypeInfo().Assembly == typeof(PythonContext).GetTypeInfo().Assembly) {
// supposedly these can't be re-initialized and return -1 to
// indicate that here, but CPython does allow passing them
// to init_builtin.
Oops, something went wrong.
@@ -154,7 +154,7 @@ public MetaOldClass(Expression/*!*/ expression, BindingRestrictions/*!*/ restric
typeof(OperationFailed)
)
),
- Ast.Dynamic(
+ DynamicExpression.Dynamic(
PythonContext.GetPythonContext(call).Invoke(
signature
),
@@ -613,7 +613,7 @@ private enum MemberAccess {
if (pyGetMem.IsNoThrow) {
return Ast.Field(
null,
- typeof(OperationFailed).GetField("Value")
+ typeof(OperationFailed).GetDeclaredField("Value")
);
} else {
return member.Throw(
@@ -58,14 +58,14 @@ public MetaPythonObject(Expression/*!*/ expression, BindingRestrictions/*!*/ res
Ast.Convert(
self,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
)
);
}
internal static MethodCallExpression MakeTryGetTypeMember(PythonContext/*!*/ PythonContext, PythonTypeSlot dts, ParameterExpression tmp, Expression instance, Expression pythonType) {
return Ast.Call(
- TypeInfo._PythonOps.SlotTryGetBoundValue,
+ PythonTypeInfo._PythonOps.SlotTryGetBoundValue,
AstUtils.Constant(PythonContext.SharedContext),
AstUtils.Convert(Utils.WeakConstant(dts), typeof(PythonTypeSlot)),
AstUtils.Convert(instance, typeof(object)),
@@ -67,7 +67,7 @@ partial class MetaPythonType : MetaPythonObject, IPythonGetable {
PythonContext state = PythonContext.GetPythonContext(member);
if (Value.IsSystemType) {
- MemberTracker tt = MemberTracker.FromMemberInfo(Value.UnderlyingSystemType);
+ MemberTracker tt = MemberTracker.FromMemberInfo(Value.UnderlyingSystemType.GetTypeInfo());
MemberGroup mg = state.Binder.GetMember(MemberRequestKind.Set, Value.UnderlyingSystemType, member.Name);
// filter protected member access against .NET types, these can only be accessed from derived types...
@@ -106,7 +106,7 @@ partial class MetaPythonType : MetaPythonObject, IPythonGetable {
if (Value.IsSystemType) {
PythonContext state = PythonContext.GetPythonContext(member);
- MemberTracker tt = MemberTracker.FromMemberInfo(Value.UnderlyingSystemType);
+ MemberTracker tt = MemberTracker.FromMemberInfo(Value.UnderlyingSystemType.GetTypeInfo());
// have the default binder perform it's operation against a TypeTracker and then
// replace the test w/ our own.
@@ -388,7 +388,7 @@ public MetaGetBinderHelper(MetaUserObject target, DynamicMetaObjectBinder binder
Ast.Convert(
_bindingInfo.Self,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
)
)
);
@@ -431,15 +431,15 @@ public MetaGetBinderHelper(MetaUserObject target, DynamicMetaObjectBinder binder
}
Expression tryGet = Ast.Call(
- TypeInfo._PythonOps.SlotTryGetBoundValue,
+ PythonTypeInfo._PythonOps.SlotTryGetBoundValue,
Ast.Constant(PythonContext.GetPythonContext(_bindingInfo.Action).SharedContext),
Ast.Convert(AstUtils.WeakConstant(dts), typeof(PythonTypeSlot)),
AstUtils.Convert(_bindingInfo.Self, typeof(object)),
Ast.Property(
Ast.Convert(
_bindingInfo.Self,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
),
_bindingInfo.Result
);
@@ -470,7 +470,7 @@ public MetaGetBinderHelper(MetaUserObject target, DynamicMetaObjectBinder binder
} else {
dict = Ast.Property(
Ast.Convert(_bindingInfo.Self, typeof(IPythonObject)),
- TypeInfo._IPythonObject.Dict
+ PythonTypeInfo._IPythonObject.Dict
);
}
@@ -498,7 +498,7 @@ public MetaGetBinderHelper(MetaUserObject target, DynamicMetaObjectBinder binder
),
Ast.Call(
dict,
- TypeInfo._PythonDictionary.TryGetvalue,
+ PythonTypeInfo._PythonDictionary.TryGetvalue,
AstUtils.Constant(GetGetMemberName(_bindingInfo.Action)),
_bindingInfo.Result
)
@@ -762,7 +762,7 @@ public InvokeBinderHelper(MetaUserObject target, InvokeMemberBinder binder, Dyna
private static MethodCallExpression/*!*/ MakeGetAttrTestAndGet(GetBindingInfo/*!*/ info, Expression/*!*/ getattr) {
return Ast.Call(
- TypeInfo._PythonOps.SlotTryGetBoundValue,
+ PythonTypeInfo._PythonOps.SlotTryGetBoundValue,
AstUtils.Constant(PythonContext.GetPythonContext(info.Action).SharedContext),
AstUtils.Convert(getattr, typeof(PythonTypeSlot)),
AstUtils.Convert(info.Self, typeof(object)),
@@ -771,7 +771,7 @@ public InvokeBinderHelper(MetaUserObject target, InvokeMemberBinder binder, Dyna
Ast.Convert(
info.Self,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
),
typeof(PythonType)
),
@@ -1018,7 +1018,7 @@ public MetaSetBinderHelper(MetaUserObject/*!*/ target, DynamicMetaObject/*!*/ va
_target.Restrict(Instance.GetType()).Restrictions.Merge(_result.Restrictions)
);
- Debug.Assert(!_result.Expression.Type.IsValueType);
+ Debug.Assert(!_result.Expression.Type.IsValueType());
return BindingHelpers.AddDynamicTestAndDefer(
_info.Action,
@@ -1225,7 +1225,7 @@ public MetaSetBinderHelper(MetaUserObject/*!*/ target, DynamicMetaObject/*!*/ va
Ast.Convert(
info.Args[0].Expression,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
),
typeof(PythonType)
),
@@ -1351,7 +1351,7 @@ public MetaSetBinderHelper(MetaUserObject/*!*/ target, DynamicMetaObject/*!*/ va
Ast.Convert(
info.Args[0].Expression,
typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
),
typeof(PythonType)
)
@@ -1368,7 +1368,7 @@ public MetaSetBinderHelper(MetaUserObject/*!*/ target, DynamicMetaObject/*!*/ va
// call __delattr__
info.Body.AddCondition(
Ast.Call(
- TypeInfo._PythonOps.SlotTryGetBoundValue,
+ PythonTypeInfo._PythonOps.SlotTryGetBoundValue,
AstUtils.Constant(PythonContext.GetPythonContext(info.Action).SharedContext),
AstUtils.Convert(AstUtils.WeakConstant(dts), typeof(PythonTypeSlot)),
AstUtils.Convert(info.Args[0].Expression, typeof(object)),
@@ -22,9 +22,9 @@
using System;
using System.Dynamic;
using System.Reflection;
-
using Microsoft.Scripting.Actions;
using Microsoft.Scripting.Generation;
+using Microsoft.Scripting.Utils;
using IronPython.Runtime.Operations;
@@ -40,7 +40,7 @@ partial class PythonBinder : DefaultBinder {
if (t != null) {
- if (typeof(Delegate).IsAssignableFrom(t) && args.Length == 1) {
+ if (typeof(Delegate).GetTypeInfo().IsAssignableFrom(t.GetTypeInfo()) && args.Length == 1) {
// PythonOps.GetDelegate(CodeContext context, object callable, Type t);
return new DynamicMetaObject(
Ast.Call(
@@ -27,6 +27,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
+using System.Linq;
using System.Reflection;
using System.Threading;
@@ -271,7 +272,7 @@ partial class PythonBinder : DefaultBinder {
public override MemberGroup/*!*/ GetMember(MemberRequestKind actionKind, Type type, string name) {
MemberGroup mg;
if (!_resolvedMembers.TryGetCachedMember(type, name, actionKind == MemberRequestKind.Get, out mg)) {
- mg = TypeInfo.GetMemberAll(
+ mg = PythonTypeInfo.GetMemberAll(
this,
actionKind,
type,
@@ -391,7 +392,7 @@ partial class PythonBinder : DefaultBinder {
}
public override bool IncludeExtensionMember(MemberInfo member) {
- return !member.DeclaringType.IsDefined(typeof(PythonHiddenBaseClassAttribute), false);
+ return !member.DeclaringType.GetTypeInfo().IsDefined(typeof(PythonHiddenBaseClassAttribute), false);
}
public override IList<Type> GetExtensionTypes(Type t) {
@@ -528,7 +529,7 @@ partial class PythonBinder : DefaultBinder {
Type curType = type.UnderlyingSystemType;
if (!_typeMembers.TryGetCachedSlot(curType, true, name, out slot)) {
- MemberGroup mg = TypeInfo.GetMember(
+ MemberGroup mg = PythonTypeInfo.GetMember(
this,
MemberRequestKind.Get,
curType,
@@ -555,7 +556,7 @@ partial class PythonBinder : DefaultBinder {
Type curType = type.UnderlyingSystemType;
if (!_resolvedMembers.TryGetCachedSlot(curType, true, name, out slot)) {
- MemberGroup mg = TypeInfo.GetMemberAll(
+ MemberGroup mg = PythonTypeInfo.GetMemberAll(
this,
MemberRequestKind.Get,
curType,
@@ -583,7 +584,7 @@ partial class PythonBinder : DefaultBinder {
if (!_typeMembers.IsFullyCached(type.UnderlyingSystemType, true)) {
Dictionary<string, KeyValuePair<PythonTypeSlot, MemberGroup>> members = new Dictionary<string, KeyValuePair<PythonTypeSlot, MemberGroup>>();
- foreach (ResolvedMember rm in TypeInfo.GetMembers(
+ foreach (ResolvedMember rm in PythonTypeInfo.GetMembers(
this,
MemberRequestKind.Get,
type.UnderlyingSystemType)) {
@@ -619,7 +620,7 @@ partial class PythonBinder : DefaultBinder {
if (!_resolvedMembers.IsFullyCached(type.UnderlyingSystemType, true)) {
Dictionary<string, KeyValuePair<PythonTypeSlot, MemberGroup>> members = new Dictionary<string, KeyValuePair<PythonTypeSlot, MemberGroup>>();
- foreach (ResolvedMember rm in TypeInfo.GetMembersAll(
+ foreach (ResolvedMember rm in PythonTypeInfo.GetMembersAll(
this,
MemberRequestKind.Get,
type.UnderlyingSystemType)) {
@@ -800,9 +801,9 @@ private class ExtensionTypeInfo {
return extInfo.PythonName;
}
- PythonTypeAttribute[] attrs = (PythonTypeAttribute[])t.GetCustomAttributes(typeof(PythonTypeAttribute), false);
- if (attrs.Length > 0 && attrs[0].Name != null) {
- return attrs[0].Name;
+ var attr = t.GetTypeInfo().GetCustomAttributes<PythonTypeAttribute>(false).FirstOrDefault();
+ if (attr != null && attr.Name != null) {
+ return attr.Name;
}
return t.Name;
@@ -817,7 +818,7 @@ private class ExtensionTypeInfo {
public static bool IsPythonType(Type/*!*/ t) {
Debug.Assert(t != null);
- return _sysTypes.ContainsKey(t) || t.IsDefined(typeof(PythonTypeAttribute), false);
+ return _sysTypes.ContainsKey(t) || t.GetTypeInfo().IsDefined(typeof(PythonTypeAttribute), false);
}
/// <summary>
@@ -829,12 +830,12 @@ private class ExtensionTypeInfo {
private void DomainManager_AssemblyLoaded(object sender, AssemblyLoadedEventArgs e) {
Assembly asm = e.Assembly;
- ExtensionTypeAttribute[] attrs = (ExtensionTypeAttribute[])asm.GetCustomAttributes(typeof(ExtensionTypeAttribute), true);
+ var attrs = asm.GetCustomAttributes<ExtensionTypeAttribute>();
- if (attrs.Length > 0) {
+ if (attrs.Any()) {
lock (_dlrExtensionTypes) {
foreach (ExtensionTypeAttribute attr in attrs) {
- if (attr.Extends.IsInterface) {
+ if (attr.Extends.IsInterface()) {
_registeredInterfaceExtensions = true;
}
@@ -138,7 +138,7 @@ public PythonOverloadResolver(PythonBinder binder, IList<DynamicMetaObject> args
}
protected override bool AllowMemberInitialization(OverloadInfo method) {
- return method.IsInstanceFactory && !method.DeclaringType.IsDefined(typeof(PythonTypeAttribute), true);
+ return method.IsInstanceFactory && !method.DeclaringType.GetTypeInfo().IsDefined(typeof(PythonTypeAttribute), true);
}
public override Expression Convert(DynamicMetaObject metaObject, Type restrictedType, ParameterInfo info, Type toType) {
@@ -207,7 +207,7 @@ static partial class PythonProtocol {
return new DynamicMetaObject(
Ast.Property(
Ast.Convert(self.Expression, typeof(IPythonObject)),
- TypeInfo._IPythonObject.PythonType
+ PythonTypeInfo._IPythonObject.PythonType
),
BindingRestrictions.Empty,
pt
Oops, something went wrong.

0 comments on commit 4960eb5

Please sign in to comment.