зеркало из https://github.com/mono/ikvm-fork.git
- Merged two passes through the options.classes dictionary.
- Only skip "assembly" type if it contains annotations. - Bug fix. Don't look for main method in excluded classes.
This commit is contained in:
Родитель
e2af047ed3
Коммит
c7c72d7a9d
|
@ -2725,6 +2725,7 @@ namespace IKVM.Internal
|
|||
List<object> assemblyAnnotations = new List<object>();
|
||||
Dictionary<string, string> baseClasses = new Dictionary<string, string>();
|
||||
Tracer.Info(Tracer.Compiler, "Parsing class files");
|
||||
Dictionary<string, ClassItem> h = new Dictionary<string, ClassItem>();
|
||||
foreach(KeyValuePair<string, ClassItem> kv in options.classes)
|
||||
{
|
||||
ClassFile f;
|
||||
|
@ -2741,12 +2742,25 @@ namespace IKVM.Internal
|
|||
if(f.Name == "assembly" && f.Annotations != null)
|
||||
{
|
||||
assemblyAnnotations.AddRange(f.Annotations);
|
||||
// HACK skip "assembly" type that exists only as a placeholder for assembly attributes
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch(ClassFormatError)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(h.ContainsKey(f.Name))
|
||||
{
|
||||
StaticCompiler.IssueMessage(Message.DuplicateClassName, f.Name);
|
||||
}
|
||||
else if(options.IsExcludedClass(f.Name))
|
||||
{
|
||||
// skip excluded class
|
||||
}
|
||||
else
|
||||
{
|
||||
h.Add(f.Name, kv.Value);
|
||||
if (options.mainClass == null && (options.guessFileKind || options.target != PEFileKinds.Dll))
|
||||
{
|
||||
foreach(ClassFile.Method m in f.Methods)
|
||||
|
@ -2760,30 +2774,6 @@ namespace IKVM.Internal
|
|||
}
|
||||
}
|
||||
}
|
||||
Dictionary<string, ClassItem> h = new Dictionary<string, ClassItem>();
|
||||
// HACK remove "assembly" type that exists only as a placeholder for assembly attributes
|
||||
options.classes.Remove("assembly");
|
||||
foreach(KeyValuePair<string, ClassItem> kv in options.classes)
|
||||
{
|
||||
string name = kv.Key;
|
||||
bool excluded = false;
|
||||
for(int j = 0; j < options.classesToExclude.Length; j++)
|
||||
{
|
||||
if(Regex.IsMatch(name, options.classesToExclude[j]))
|
||||
{
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(h.ContainsKey(name))
|
||||
{
|
||||
StaticCompiler.IssueMessage(Message.DuplicateClassName, name);
|
||||
excluded = true;
|
||||
}
|
||||
if(!excluded)
|
||||
{
|
||||
h[name] = kv.Value;
|
||||
}
|
||||
}
|
||||
options.classes = null;
|
||||
|
||||
|
@ -3405,6 +3395,18 @@ namespace IKVM.Internal
|
|||
item.jar = jar ?? "resources.jar";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
internal bool IsExcludedClass(string className)
|
||||
{
|
||||
for (int i = 0; i < classesToExclude.Length; i++)
|
||||
{
|
||||
if (Regex.IsMatch(className, classesToExclude[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum Message
|
||||
|
|
Загрузка…
Ссылка в новой задаче