[svn] r7651: nemerle/trunk: ncc/external/LibrariesLoader.n
tools/reflector-addon/src/LanguageWriter.n
pbludov
svnadmin at nemerle.org
Sat May 5 11:53:47 CEST 2007
Log:
Hack to recover location of an assembly loaded from the memory.
Author: pbludov
Date: Sat May 5 11:53:42 2007
New Revision: 7651
Modified:
nemerle/trunk/ncc/external/LibrariesLoader.n
nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n
Modified: nemerle/trunk/ncc/external/LibrariesLoader.n
==============================================================================
--- nemerle/trunk/ncc/external/LibrariesLoader.n (original)
+++ nemerle/trunk/ncc/external/LibrariesLoader.n Sat May 5 11:53:42 2007
@@ -72,7 +72,7 @@
Manager = man;
def assembly_dir (t) {
- DirectoryOfCodebase (System.Uri(t.Assembly.CodeBase).LocalPath);
+ DirectoryOfCodebase (getAssemblyLocation(t.Assembly));
};
// include current directory and directories where
@@ -211,6 +211,10 @@
SR.Assembly.LoadFrom (path)
}
+ public virtual getAssemblyLocation (assembly : SR.Assembly) : string {
+ System.Uri(assembly.CodeBase).LocalPath
+ }
+
/* -- PRIVATE METHODS -------------------------------------------------- */
private LookupAssembly (name : string) : SR.Assembly
@@ -580,7 +584,7 @@
LibRefManager = mgr;
Manager = mgr.Manager;
_library = assembly;
- _location = Location (Location.GetFileIndex (System.Uri (assembly.CodeBase).LocalPath), 0, 0);
+ _location = Location (Location.GetFileIndex (mgr.getAssemblyLocation(assembly)), 0, 0);
_location.MarkAsGenerated();
// Scans the assembly custom attributes looking for something interesting...
Modified: nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n
==============================================================================
--- nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n (original)
+++ nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n Sat May 5 11:53:42 2007
@@ -199,21 +199,20 @@
{
def visitor = UsingNamespaceVisitor();
visitor.VisitNamespace(value);
+ def namespapes = visitor.Namespaces.Filter(ns => !string.IsNullOrEmpty(ns));
- mutable foundAny = false;
- visitor.Namespaces.Sort(string.Compare).Iter(ns =>
- unless (string.IsNullOrEmpty(ns))
+ unless (namespapes.Length == 0)
+ {
+ namespapes.Iter(ns =>
{
WriteKeyword("using");
Write(" ");
Write(ns);
EndLine();
- foundAny = true;
});
-
- when (foundAny)
WriteLine();
}
+ }
def visibleTypes = value.Types.ToList()
.Filter(e : ITypeDeclaration => _configuration.IsVisible(e));
@@ -359,7 +358,7 @@
if (value.Else.Statements.Count == 1 && value.Else.Statements[0] is IConditionStatement)
{
- // else if case
+ // 'else if' case
//
Write(" ");
WriteConditionStatement(value.Else.Statements[0] :> IConditionStatement);
@@ -652,7 +651,7 @@
| expr is IMethodOfExpression => WriteMethodOfExpression(expr);
| expr is IQueryExpression => WriteQueryExpression(expr);
#endif
- | _ => throw NotSupportedException();
+ | expr => throw NotSupportedException($"Invalid expression type '$(expr.GetType().Name)'.");
}
private WriteLiteralExpression(expression : ILiteralExpression) : void
@@ -1557,6 +1556,8 @@
unless (value.Namespace.Length == 0 && value.Name == "<Module>")
{
+ WriteTypeProperties(value, "Name");
+
def wrapper = CustomAttributeWrapper.Type(value);
WriteDocumentation(value);
WriteCustomAttributeList(wrapper.Attributes);
@@ -2307,7 +2308,12 @@
private WriteDeclaringTypeProperties(value : ITypeReference) : void
{
- WriteProperty("Declaring Type", value.GetUserFriendlyName());
+ WriteTypeProperties(value, "Declaring Type");
+ }
+
+ private WriteTypeProperties(value : ITypeReference, propName : string) : void
+ {
+ WriteProperty(propName, value.GetUserFriendlyName());
match (value.GetAssembly())
{
| null
@@ -2485,6 +2491,9 @@
| _ is IContinueStatement
| _ is IMemoryCopyStatement
| _ is IMemoryInitializeStatement
+#if REFLECTOR_VER_50
+ | _ is IDebugBreakStatement
+#endif
| _ is ILabeledStatement => true;
| _ => throw NotSupportedException($"Invalid statement type '$(value.GetType().Name)'.");
}
More information about the svn
mailing list