From c1f30ef62cee7ef8022e7c968a3a917157ef4513 Mon Sep 17 00:00:00 2001 From: Jeff Hardy Date: Wed, 13 Mar 2013 14:50:01 -0700 Subject: [PATCH] Fix broken build from a bad rebase. --- .../Properties/AssemblyInfo.cs | 1 + .../Runtime/ClrModule.Compilation.cs | 2 +- .../Runtime/SavableScriptCode.cs | 41 +++++++++++++------ .../Properties/AssemblyInfo.cs | 6 --- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Languages/IronPython/IronPython.Modules/Properties/AssemblyInfo.cs b/Languages/IronPython/IronPython.Modules/Properties/AssemblyInfo.cs index 4672c85c31..0f4cad160c 100644 --- a/Languages/IronPython/IronPython.Modules/Properties/AssemblyInfo.cs +++ b/Languages/IronPython/IronPython.Modules/Properties/AssemblyInfo.cs @@ -39,3 +39,4 @@ [assembly: SecurityTransparent] [assembly: AllowPartiallyTrustedCallers] [assembly: SecurityRules(SecurityRuleSet.Level1)] +#endif diff --git a/Languages/IronPython/IronPython/Runtime/ClrModule.Compilation.cs b/Languages/IronPython/IronPython/Runtime/ClrModule.Compilation.cs index 2bbfd794dc..ce4ef39288 100644 --- a/Languages/IronPython/IronPython/Runtime/ClrModule.Compilation.cs +++ b/Languages/IronPython/IronPython/Runtime/ClrModule.Compilation.cs @@ -660,7 +660,7 @@ private static CustomAttributeBuilder MakeCab(ClrAttributeInfo attrib) attributes = new List(); func.__dict__["clr_attributes__"] = attributes; } - attributes.AddRange(attribs); + attributes.extend(attribs); return func; }; diff --git a/Runtime/Microsoft.Dynamic/Runtime/SavableScriptCode.cs b/Runtime/Microsoft.Dynamic/Runtime/SavableScriptCode.cs index 2015b7ddbe..1ce903619f 100644 --- a/Runtime/Microsoft.Dynamic/Runtime/SavableScriptCode.cs +++ b/Runtime/Microsoft.Dynamic/Runtime/SavableScriptCode.cs @@ -84,14 +84,22 @@ class CodeInfo { // build the assembly & type gen that all the script codes will live in... AssemblyGen ag = new AssemblyGen(new AssemblyName(name), dir, ext, /*emitSymbols*/false); + GenerateAssemblyCode(ag, codes); + ag.SaveAssembly(); + } + + public static void GenerateAssemblyCode(AssemblyGen ag, SavableScriptCode[] codes) + { TypeBuilder tb = ag.DefinePublicType("DLRCachedCode", typeof(object), true); TypeGen tg = new TypeGen(ag, tb); // then compile all of the code Dictionary> langCtxBuilders = new Dictionary>(); - foreach (SavableScriptCode sc in codes) { + foreach (SavableScriptCode sc in codes) + { List builders; - if (!langCtxBuilders.TryGetValue(sc.LanguageContext.GetType(), out builders)) { + if (!langCtxBuilders.TryGetValue(sc.LanguageContext.GetType(), out builders)) + { langCtxBuilders[sc.LanguageContext.GetType()] = builders = new List(); } @@ -111,16 +119,19 @@ class CodeInfo { var langsWithBuilders = langCtxBuilders.ToArray(); // lang ctx array - ilgen.EmitArray(typeof(Type), langsWithBuilders.Length, (index) => { + ilgen.EmitArray(typeof(Type), langsWithBuilders.Length, (index) => + { ilgen.Emit(OpCodes.Ldtoken, langsWithBuilders[index].Key); ilgen.EmitCall(typeof(Type).GetMethod("GetTypeFromHandle", new[] { typeof(RuntimeTypeHandle) })); }); // builders array of array - ilgen.EmitArray(typeof(Delegate[]), langsWithBuilders.Length, (index) => { + ilgen.EmitArray(typeof(Delegate[]), langsWithBuilders.Length, (index) => + { List builders = langsWithBuilders[index].Value; - ilgen.EmitArray(typeof(Delegate), builders.Count, (innerIndex) => { + ilgen.EmitArray(typeof(Delegate), builders.Count, (innerIndex) => + { ilgen.EmitNull(); ilgen.Emit(OpCodes.Ldftn, builders[innerIndex].Builder); ilgen.EmitNew( @@ -131,23 +142,30 @@ class CodeInfo { }); // paths array of array - ilgen.EmitArray(typeof(string[]), langsWithBuilders.Length, (index) => { + ilgen.EmitArray(typeof(string[]), langsWithBuilders.Length, (index) => + { List builders = langsWithBuilders[index].Value; - ilgen.EmitArray(typeof(string), builders.Count, (innerIndex) => { + ilgen.EmitArray(typeof(string), builders.Count, (innerIndex) => + { ilgen.EmitString(builders[innerIndex].Code.SourceUnit.Path); }); }); // 4th element in tuple - custom per-language data - ilgen.EmitArray(typeof(string[]), langsWithBuilders.Length, (index) => { + ilgen.EmitArray(typeof(string[]), langsWithBuilders.Length, (index) => + { List builders = langsWithBuilders[index].Value; - ilgen.EmitArray(typeof(string), builders.Count, (innerIndex) => { + ilgen.EmitArray(typeof(string), builders.Count, (innerIndex) => + { ICustomScriptCodeData data = builders[innerIndex].Code as ICustomScriptCodeData; - if (data != null) { + if (data != null) + { ilgen.EmitString(data.GetCustomScriptCodeData()); - } else { + } + else + { ilgen.Emit(OpCodes.Ldnull); } }); @@ -165,7 +183,6 @@ class CodeInfo { )); tg.FinishType(); - ag.SaveAssembly(); } /// diff --git a/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs b/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs index 4b3d4886fd..e8a3f7b698 100644 --- a/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs +++ b/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs @@ -48,9 +48,6 @@ [assembly: SecurityTransparent] [assembly: AllowPartiallyTrustedCallers] [assembly: SecurityRules(SecurityRuleSet.Level1)] - -#if !WIN8 -[assembly: SecurityTransparent] #endif #if !SILVERLIGHT @@ -59,6 +56,3 @@ [assembly: AssemblyInformationalVersion("1.1")] #endif -#if !SILVERLIGHT && !WP75 && !WIN8 -[assembly: AllowPartiallyTrustedCallers] -#endif