Skip to content
Browse files

CLJCLR-12: Add AssemblyName overload to GenContext

  • Loading branch information...
1 parent 857731c commit 3da1f6e217fca951011d56524541de431b853250 Aaron Craelius committed with dmiller
Showing with 21 additions and 9 deletions.
  1. +21 −9 Clojure/Clojure/CljCompiler/Ast/GenContext.cs
View
30 Clojure/Clojure/CljCompiler/Ast/GenContext.cs
@@ -77,13 +77,19 @@ public ISymbolDocumentWriter DocWriter
public static GenContext CreateWithInternalAssembly(string assyName, bool createDynInitHelper)
{
- return new GenContext(assyName, assyName, ".dll", null, createDynInitHelper);
+ return CreateGenContext(assyName, assyName, ".dll", null, createDynInitHelper);
+ }
+
+ public static GenContext CreateWithExternalAssembly(string sourceName, AssemblyName assemblyName, string extension, bool createDynInitHelper)
+ {
+ string path = Compiler.CompilePathVar.deref() as string;
+ return new GenContext(path ?? System.IO.Directory.GetCurrentDirectory(), assemblyName, extension, createDynInitHelper, sourceName);
}
public static GenContext CreateWithExternalAssembly(string sourceName, string assyName, string extension, bool createDynInitHelper)
{
string path = Compiler.CompilePathVar.deref() as string;
- return new GenContext(sourceName, assyName, extension, path ?? System.IO.Directory.GetCurrentDirectory(),createDynInitHelper);
+ return CreateGenContext(sourceName, assyName, extension, path ?? System.IO.Directory.GetCurrentDirectory(),createDynInitHelper);
}
public static GenContext CreateWithExternalAssembly(string assyName, string extension, bool createDynInitHelper)
@@ -91,14 +97,8 @@ public static GenContext CreateWithExternalAssembly(string assyName, string exte
return CreateWithExternalAssembly(assyName, assyName, extension, createDynInitHelper);
}
- private GenContext(string sourceName, string assyName, string extension, string directory, bool createDynInitHelper)
+ private static GenContext CreateGenContext(string sourceName, string assyName, string extension, string directory, bool createDynInitHelper)
{
- // TODO: Make this settable from a *debug* flag
-#if DEBUG
- _isDebuggable = true;
-#else
- _isDebuggable = false;
-#endif
if (directory != null)
{
if (directory.Length > 0 ) //&& directory != ".")
@@ -106,6 +106,18 @@ private GenContext(string sourceName, string assyName, string extension, string
}
AssemblyName aname = new AssemblyName(assyName);
+ return new GenContext(directory, aname, extension, createDynInitHelper, sourceName);
+ }
+
+ private GenContext(string directory, AssemblyName aname, string extension, bool createDynInitHelper, string sourceName)
+ {
+ // TODO: Make this settable from a *debug* flag
+#if DEBUG
+ _isDebuggable = true;
+#else
+ _isDebuggable = false;
+#endif
+
_assyGen = new AssemblyGen(aname, directory, extension, _isDebuggable);
if ( createDynInitHelper )
_dynInitHelper = new DynInitHelper(_assyGen, GenerateName());

0 comments on commit 3da1f6e

Please sign in to comment.
Something went wrong with that request. Please try again.