Index: scripts/Templates/NodeImpl.cs
===================================================================
--- scripts/Templates/NodeImpl.cs (revision 3325)
+++ scripts/Templates/NodeImpl.cs (working copy)
@@ -6,8 +6,8 @@
%>namespace Boo.Lang.Compiler.Ast
{
+ using System;
using System.Collections;
- using System.Runtime.Serialization;
[System.Serializable]
public ${abstractClass}partial class ${node.Name} : ${join(node.BaseTypes, ', ')}
@@ -119,7 +119,7 @@
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
override public object Clone()
{
- ${node.Name} clone = (${node.Name})FormatterServices.GetUninitializedObject(typeof(${node.Name}));
+ ${node.Name} clone = (${node.Name})Activator.CreateInstance(typeof(${node.Name}));
clone._lexicalInfo = _lexicalInfo;
clone._endSourceLocation = _endSourceLocation;
clone._documentation = _documentation;
Index: src/Boo.Lang.CodeDom/AssemblyInfo.boo
===================================================================
--- src/Boo.Lang.CodeDom/AssemblyInfo.boo (revision 3325)
+++ src/Boo.Lang.CodeDom/AssemblyInfo.boo (working copy)
@@ -31,8 +31,8 @@
// Ian MacLean (original C# version)
import System.Reflection;
+import System.Security;
import System.Security.Permissions;
-
[assembly: ReflectionPermission(SecurityAction.RequestMinimum,
ReflectionEmit: true,
TypeInformation: true)]
@@ -44,4 +44,4 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyVersion("2.0.9.1")]
-
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.Compiler/AssemblyInfo.cs
===================================================================
--- src/Boo.Lang.Compiler/AssemblyInfo.cs (revision 3325)
+++ src/Boo.Lang.Compiler/AssemblyInfo.cs (working copy)
@@ -27,6 +27,7 @@
#endregion
using System.Reflection;
+using System.Security;
using System.Security.Permissions;
[assembly: AssemblyTitle("boo - an extensible programming language for the CLI")]
@@ -39,4 +40,4 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
[assembly: AssemblyDelaySign(false)]
-
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2005.csproj
===================================================================
--- src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2005.csproj (revision 3325)
+++ src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2005.csproj (working copy)
@@ -88,6 +88,7 @@
+
Index: src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2008.csproj
===================================================================
--- src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2008.csproj (revision 3325)
+++ src/Boo.Lang.Compiler/Boo.Lang.Compiler-VS2008.csproj (working copy)
@@ -109,6 +109,7 @@
+
Index: src/Boo.Lang.Compiler/Boo.Lang.Compiler.mdp
===================================================================
--- src/Boo.Lang.Compiler/Boo.Lang.Compiler.mdp (revision 3325)
+++ src/Boo.Lang.Compiler/Boo.Lang.Compiler.mdp (working copy)
@@ -45,6 +45,7 @@
+
Index: src/Boo.Lang.Compiler/CompilerParameters.cs
===================================================================
--- src/Boo.Lang.Compiler/CompilerParameters.cs (revision 3325)
+++ src/Boo.Lang.Compiler/CompilerParameters.cs (working copy)
@@ -34,6 +34,8 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
using System.Text.RegularExpressions;
using Boo.Lang.Compiler.Ast;
using Boo.Lang.Compiler.TypeSystem;
@@ -113,10 +115,13 @@
public CompilerParameters(IReflectionTypeSystemProvider reflectionProvider, bool loadDefaultReferences)
{
_libpaths = new ArrayList();
- _systemDir = GetSystemDir();
- _libpaths.Add(_systemDir);
- _libpaths.Add(Directory.GetCurrentDirectory());
-
+ _hasDiscoveryPermission = MediumTrust.HasDiscoveryPermission();
+ if (_hasDiscoveryPermission)
+ {
+ _systemDir = GetSystemDir();
+ _libpaths.Add(_systemDir);
+ _libpaths.Add(Directory.GetCurrentDirectory());
+ }
_pipeline = null;
_input = new CompilerInputCollection();
_resources = new CompilerResourceCollection();
@@ -131,7 +136,7 @@
_generateInMemory = true;
_StdLib = true;
- if (null != Environment.GetEnvironmentVariable("TRACE"))
+ if (MediumTrust.HasEnvironmentPermission() && null != Environment.GetEnvironmentVariable("TRACE"))
EnableTraceSwitch();
_delaySign = false;
@@ -162,7 +167,9 @@
//boo.lang.extensions.dll
//try loading extensions next to Boo.Lang (in the same directory)
- string tentative = Path.Combine(Path.GetDirectoryName(_booAssembly.Location) , "Boo.Lang.Extensions.dll");
+ string tentative = "Boo.Lang.Extensions.dll";
+ if (_hasDiscoveryPermission)
+ tentative = Path.Combine(Path.GetDirectoryName(_booAssembly.Location), tentative);
ICompileUnit extensionsAssembly = LoadAssembly(tentative, false);
if(extensionsAssembly == null)//if failed, try loading from the gac
extensionsAssembly = LoadAssembly("Boo.Lang.Extensions", false);
@@ -705,6 +712,7 @@
bool _warnAsError = false;
Util.Set _disabledWarnings = new Util.Set();
Util.Set _promotedWarnings = new Util.Set();
+ private bool _hasDiscoveryPermission;
public bool NoWarn
{
Index: src/Boo.Lang.Compiler/Pipelines/Parse.cs
===================================================================
--- src/Boo.Lang.Compiler/Pipelines/Parse.cs (revision 3325)
+++ src/Boo.Lang.Compiler/Pipelines/Parse.cs (working copy)
@@ -48,7 +48,7 @@
static Assembly FindParserAssembly()
{
Assembly thisAssembly = typeof(Parse).Assembly;
- string thisLocation = thisAssembly.Location;
+ string thisLocation = MediumTrust.HasDiscoveryPermission() ? thisAssembly.Location : "";
string parserLocation = thisLocation.EndsWith("Boo.Lang.Compiler.dll")
? thisLocation.Substring(0, thisLocation.Length - "Boo.Lang.Compiler.dll".Length) + "Boo.Lang.Parser.dll"
: "";
Index: src/Boo.Lang.Compiler/Steps/EmitAssembly.cs
===================================================================
--- src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (revision 3325)
+++ src/Boo.Lang.Compiler/Steps/EmitAssembly.cs (working copy)
@@ -407,6 +407,19 @@
public void Run()
{
+ if (MediumTrust.HasAppDomainPermission())
+ RunInFullTrust();
+ else
+ {
+ CreateTypes();
+ }
+ }
+ private void RunInMediumTrust()
+ {
+ CreateTypes();
+ }
+ private void RunInFullTrust()
+ {
ResolveEventHandler resolveHandler = new ResolveEventHandler(OnTypeResolve);
AppDomain current = Thread.GetDomain();
@@ -418,9 +431,9 @@
finally
{
current.TypeResolve -= resolveHandler;
- }
+ }
}
-
+
void CreateTypes()
{
foreach (TypeMember type in _types)
Index: src/Boo.Lang.Compiler/TypeSystem/Reflection/AssemblyReference.cs
===================================================================
--- src/Boo.Lang.Compiler/TypeSystem/Reflection/AssemblyReference.cs (revision 3325)
+++ src/Boo.Lang.Compiler/TypeSystem/Reflection/AssemblyReference.cs (working copy)
@@ -26,6 +26,8 @@
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
+using System.Reflection;
+
namespace Boo.Lang.Compiler.TypeSystem.Reflection
{
using System;
@@ -46,7 +48,7 @@
public string Name
{
- get { return _assembly.GetName().Name; }
+ get { return new AssemblyName(_assembly.FullName).Name; }
}
public string FullName
Index: src/Boo.Lang.Extensions/AssemblyInfo.boo
===================================================================
--- src/Boo.Lang.Extensions/AssemblyInfo.boo (revision 3325)
+++ src/Boo.Lang.Extensions/AssemblyInfo.boo (working copy)
@@ -28,6 +28,7 @@
import System.Reflection;
import System.Security.Permissions;
+import System.Security;
[assembly: ReflectionPermission(SecurityAction.RequestMinimum,
ReflectionEmit: true)]
@@ -40,4 +41,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.Interpreter/AssemblyInfo.boo
===================================================================
--- src/Boo.Lang.Interpreter/AssemblyInfo.boo (revision 3325)
+++ src/Boo.Lang.Interpreter/AssemblyInfo.boo (working copy)
@@ -27,6 +27,7 @@
#endregion
import System.Reflection
+import System.Security
[assembly: AssemblyTitle("Boo Language Interpreter Library")]
[assembly: AssemblyDescription("")]
@@ -37,4 +38,4 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
-
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.Parser/AssemblyInfo.cs
===================================================================
--- src/Boo.Lang.Parser/AssemblyInfo.cs (revision 3325)
+++ src/Boo.Lang.Parser/AssemblyInfo.cs (working copy)
@@ -27,6 +27,7 @@
#endregion
using System.Reflection;
+using System.Security;
[assembly: AssemblyTitle("boo antlr based parser")]
[assembly: AssemblyDescription("")]
@@ -38,4 +39,5 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
[assembly: AssemblyDelaySign(false)]
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.PatternMatching/AssemblyInfo.boo
===================================================================
--- src/Boo.Lang.PatternMatching/AssemblyInfo.boo (revision 3325)
+++ src/Boo.Lang.PatternMatching/AssemblyInfo.boo (working copy)
@@ -27,6 +27,7 @@
#endregion
import System.Reflection
+import System.Security
[assembly: AssemblyTitle("Boo Pattern Matching Library")]
[assembly: AssemblyDescription("")]
@@ -37,4 +38,4 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
-
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang.Useful/AssemblyInfo.boo
===================================================================
--- src/Boo.Lang.Useful/AssemblyInfo.boo (revision 3325)
+++ src/Boo.Lang.Useful/AssemblyInfo.boo (working copy)
@@ -27,6 +27,7 @@
#endregion
import System.Reflection
+import System.Security
[assembly: AssemblyTitle("Boo Language Useful Library")]
[assembly: AssemblyDescription("")]
@@ -37,4 +38,4 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
-
+[assembly: AllowPartiallyTrustedCallers]
Index: src/Boo.Lang/AssemblyInfo.cs
===================================================================
--- src/Boo.Lang/AssemblyInfo.cs (revision 3325)
+++ src/Boo.Lang/AssemblyInfo.cs (working copy)
@@ -26,7 +26,8 @@
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using System.Reflection;
+using System.Reflection;
+using System.Security;
[assembly: AssemblyTitle("boo - an extensible programming language for the CLI")]
[assembly: AssemblyDescription("")]
@@ -43,4 +44,5 @@
#endif
[assembly: AssemblyKeyName("")]
-[assembly: System.Resources.NeutralResourcesLanguage("en")]
+[assembly: System.Resources.NeutralResourcesLanguage("en")]
+[assembly: AllowPartiallyTrustedCallers]
\ No newline at end of file
Index: src/booc/AssemblyInfo.cs
===================================================================
--- src/booc/AssemblyInfo.cs (revision 3325)
+++ src/booc/AssemblyInfo.cs (working copy)
@@ -27,6 +27,7 @@
#endregion
using System.Reflection;
+using System.Security;
[assembly: AssemblyTitle("boo compiler")]
[assembly: AssemblyDescription("")]
@@ -38,3 +39,4 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.0.9.1")]
[assembly: AssemblyDelaySign(false)]
+[assembly: AllowPartiallyTrustedCallers]
\ No newline at end of file
Index: tests/BooCompiler.Tests/BooCompiler.Tests-VS2005.csproj
===================================================================
--- tests/BooCompiler.Tests/BooCompiler.Tests-VS2005.csproj (revision 3325)
+++ tests/BooCompiler.Tests/BooCompiler.Tests-VS2005.csproj (working copy)
@@ -103,6 +103,8 @@
+
+
Index: tests/BooCompiler.Tests/BooCompiler.Tests-VS2008.csproj
===================================================================
--- tests/BooCompiler.Tests/BooCompiler.Tests-VS2008.csproj (revision 3325)
+++ tests/BooCompiler.Tests/BooCompiler.Tests-VS2008.csproj (working copy)
@@ -79,6 +79,10 @@
False
..\..\build\Boo.Lang.Extensions.dll
+
+ False
+ ..\..\bin\Boo.Lang.PatternMatching.dll
+
@@ -120,6 +124,8 @@
+
+