mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
move imports into CommonWalker so that we can add to imports from JavaMaker too (currently not needed)
This commit is contained in:
parent
5eff7e331c
commit
82e2dcf770
@ -519,6 +519,7 @@ namespace Twiglet.CS2J.Translator
|
||||
netMaker.AliasNamespaces = javaMaker.CUMap[typeName].NameSpaceAliasValues;
|
||||
|
||||
netMaker.IsJavaish = cfg.InternalIsJavaish;
|
||||
netMaker.Imports = javaMaker.Imports;
|
||||
|
||||
if (cfg.DebugLevel > 5) Console.Out.WriteLine("Translating {0} Net Calls to Java", javaFName);
|
||||
NetMaker.compilation_unit_return javaCompilationUnit = netMaker.compilation_unit();
|
||||
|
@ -201,6 +201,34 @@ namespace Twiglet.CS2J.Translator.Transform
|
||||
}
|
||||
}
|
||||
|
||||
private Set<string> imports = new Set<string>();
|
||||
public Set<string> Imports
|
||||
{
|
||||
get
|
||||
{
|
||||
return imports;
|
||||
}
|
||||
set
|
||||
{
|
||||
imports = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void AddToImports(string imp) {
|
||||
if (!String.IsNullOrEmpty(imp))
|
||||
{
|
||||
Imports.Add(imp);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddToImports(ICollection<string> imps) {
|
||||
if (imps != null) {
|
||||
foreach (string imp in imps) {
|
||||
AddToImports(imp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Wraps a compilation unit with its imports search path
|
||||
|
@ -75,8 +75,6 @@ scope MkNonGeneric {
|
||||
public List<string> AliasKeys { get; set; }
|
||||
public List<string> AliasNamespaces { get; set; }
|
||||
|
||||
private Set<string> Imports { get; set; }
|
||||
|
||||
protected CommonTree mkImports() {
|
||||
|
||||
CommonTree root = (CommonTree)adaptor.Nil;
|
||||
@ -93,7 +91,7 @@ scope MkNonGeneric {
|
||||
|
||||
}
|
||||
|
||||
public void AddToImports(string imp) {
|
||||
public override void AddToImports(string imp) {
|
||||
// Don't add import if its namespace is within our type
|
||||
// if (!imp.StartsWith($NSContext::currentNS+".")) {
|
||||
if (imp != null && (CompUnitName == null || CompUnitName.Length == 0 || !imp.StartsWith(NSPrefix(CompUnitName)))) {
|
||||
@ -102,14 +100,6 @@ scope MkNonGeneric {
|
||||
// }
|
||||
}
|
||||
|
||||
public void AddToImports(ICollection<string> imps) {
|
||||
if (imps != null) {
|
||||
foreach (string imp in imps) {
|
||||
AddToImports(imp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string ParentNameSpace {
|
||||
get {
|
||||
return ((NSContext_scope)$NSContext.ToArray()[1]).currentNS;
|
||||
@ -532,8 +522,6 @@ public compilation_unit
|
||||
scope NSContext, PrimitiveRep, MkNonGeneric;
|
||||
@init {
|
||||
|
||||
Imports = new Set<string>();
|
||||
|
||||
$PrimitiveRep::primitiveTypeAsObject = false;
|
||||
$MkNonGeneric::scrubGenericArgs = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user