mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Import this class when it is used
This commit is contained in:
parent
4b9e99124c
commit
b7edabb9dc
@ -84,6 +84,10 @@ scope NSContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected string NSPrefix(string ns) {
|
||||||
|
return (String.IsNullOrEmpty(ns) ? "" : ns + ".");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -119,7 +123,7 @@ scope NSContext;
|
|||||||
{ Debug("namespace: " + $qi.thetext);
|
{ Debug("namespace: " + $qi.thetext);
|
||||||
$NSContext::searchpath.Add($qi.thetext);
|
$NSContext::searchpath.Add($qi.thetext);
|
||||||
// extend parent namespace
|
// extend parent namespace
|
||||||
$NSContext::currentNS = ParentNameSpace + (String.IsNullOrEmpty(ParentNameSpace) ? "" : ".") + $qi.thetext;
|
$NSContext::currentNS = NSPrefix(ParentNameSpace) + $qi.thetext;
|
||||||
}
|
}
|
||||||
namespace_block ';'? ;
|
namespace_block ';'? ;
|
||||||
namespace_block:
|
namespace_block:
|
||||||
@ -675,7 +679,8 @@ scope NSContext;
|
|||||||
Debug("Processing class: " + $type_or_generic.type);
|
Debug("Processing class: " + $type_or_generic.type);
|
||||||
klass.Uses = this.CollectUses;
|
klass.Uses = this.CollectUses;
|
||||||
klass.Aliases = this.CollectAliases;
|
klass.Aliases = this.CollectAliases;
|
||||||
klass.TypeName = this.ParentNameSpace + "." + mkTypeName($type_or_generic.type, $type_or_generic.generic_arguments);
|
klass.Imports = new string[] {NSPrefix(ParentNameSpace) + $type_or_generic.type};
|
||||||
|
klass.TypeName = NSPrefix(ParentNameSpace) + mkTypeName($type_or_generic.type, $type_or_generic.generic_arguments);
|
||||||
if ($type_or_generic.generic_arguments.Count > 0) {
|
if ($type_or_generic.generic_arguments.Count > 0) {
|
||||||
klass.TypeParams = $type_or_generic.generic_arguments.ToArray();
|
klass.TypeParams = $type_or_generic.generic_arguments.ToArray();
|
||||||
}
|
}
|
||||||
@ -812,7 +817,8 @@ scope NSContext;
|
|||||||
Debug("Processing enum: " + $identifier.text);
|
Debug("Processing enum: " + $identifier.text);
|
||||||
eenum.Uses = this.CollectUses;
|
eenum.Uses = this.CollectUses;
|
||||||
eenum.Aliases = this.CollectAliases;
|
eenum.Aliases = this.CollectAliases;
|
||||||
eenum.TypeName = this.ParentNameSpace + "." + $identifier.text;
|
eenum.Imports = new string[] {NSPrefix(ParentNameSpace) + $identifier.text};
|
||||||
|
eenum.TypeName = NSPrefix(ParentNameSpace) + $identifier.text;
|
||||||
// Nested types can see things in this space
|
// Nested types can see things in this space
|
||||||
$NSContext::searchpath.Add(eenum.TypeName);
|
$NSContext::searchpath.Add(eenum.TypeName);
|
||||||
$NSContext::currentNS = eenum.TypeName;
|
$NSContext::currentNS = eenum.TypeName;
|
||||||
@ -853,7 +859,8 @@ scope NSContext;
|
|||||||
Debug("Processing delegate: " + $identifier.text);
|
Debug("Processing delegate: " + $identifier.text);
|
||||||
dlegate.Uses = this.CollectUses;
|
dlegate.Uses = this.CollectUses;
|
||||||
dlegate.Aliases = this.CollectAliases;
|
dlegate.Aliases = this.CollectAliases;
|
||||||
dlegate.TypeName = this.ParentNameSpace + "." + mkTypeName($identifier.text, $variant_generic_parameter_list.tyargs);
|
dlegate.Imports = new string[] {NSPrefix(ParentNameSpace) + $identifier.text};
|
||||||
|
dlegate.TypeName = NSPrefix(ParentNameSpace) + mkTypeName($identifier.text, $variant_generic_parameter_list.tyargs);
|
||||||
if ($variant_generic_parameter_list.tyargs != null && $variant_generic_parameter_list.tyargs.Count > 0) {
|
if ($variant_generic_parameter_list.tyargs != null && $variant_generic_parameter_list.tyargs.Count > 0) {
|
||||||
dlegate.TypeParams = $variant_generic_parameter_list.tyargs.ToArray();
|
dlegate.TypeParams = $variant_generic_parameter_list.tyargs.ToArray();
|
||||||
}
|
}
|
||||||
@ -943,7 +950,8 @@ scope NSContext;
|
|||||||
Debug("Processing interface: " + $identifier.text);
|
Debug("Processing interface: " + $identifier.text);
|
||||||
iface.Uses = this.CollectUses;
|
iface.Uses = this.CollectUses;
|
||||||
iface.Aliases = this.CollectAliases;
|
iface.Aliases = this.CollectAliases;
|
||||||
iface.TypeName = this.ParentNameSpace + "." + mkTypeName($identifier.text, $variant_generic_parameter_list.tyargs);
|
iface.Imports = new string[] {NSPrefix(ParentNameSpace) + $identifier.text};
|
||||||
|
iface.TypeName = NSPrefix(ParentNameSpace) + mkTypeName($identifier.text, $variant_generic_parameter_list.tyargs);
|
||||||
if ($variant_generic_parameter_list.tyargs != null && $variant_generic_parameter_list.tyargs.Count > 0) {
|
if ($variant_generic_parameter_list.tyargs != null && $variant_generic_parameter_list.tyargs.Count > 0) {
|
||||||
iface.TypeParams = $variant_generic_parameter_list.tyargs.ToArray();
|
iface.TypeParams = $variant_generic_parameter_list.tyargs.ToArray();
|
||||||
}
|
}
|
||||||
@ -1029,7 +1037,8 @@ scope NSContext;
|
|||||||
Debug("Processing struct: " + $type_or_generic.type);
|
Debug("Processing struct: " + $type_or_generic.type);
|
||||||
strukt.Uses = this.CollectUses;
|
strukt.Uses = this.CollectUses;
|
||||||
strukt.Aliases = this.CollectAliases;
|
strukt.Aliases = this.CollectAliases;
|
||||||
strukt.TypeName = this.ParentNameSpace + "." + mkTypeName($type_or_generic.type, $type_or_generic.generic_arguments);
|
strukt.Imports = new string[] {NSPrefix(ParentNameSpace) + $type_or_generic.type};
|
||||||
|
strukt.TypeName = NSPrefix(ParentNameSpace) + mkTypeName($type_or_generic.type, $type_or_generic.generic_arguments);
|
||||||
if ($type_or_generic.generic_arguments.Count > 0) {
|
if ($type_or_generic.generic_arguments.Count > 0) {
|
||||||
strukt.TypeParams = $type_or_generic.generic_arguments.ToArray();
|
strukt.TypeParams = $type_or_generic.generic_arguments.ToArray();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user