1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

Sets are IEnumerable, fix AddToImports to be satisifed with that

This commit is contained in:
Kevin Glynn 2011-05-02 12:53:30 +02:00
parent 9d6b510a59
commit 1c0fa6586b
3 changed files with 10 additions and 4 deletions

View File

@ -519,7 +519,8 @@ namespace Twiglet.CS2J.Translator
netMaker.AliasNamespaces = javaMaker.CUMap[typeName].NameSpaceAliasValues;
netMaker.IsJavaish = cfg.InternalIsJavaish;
netMaker.Imports = javaMaker.Imports;
netMaker.Imports = new Set<String>();
netMaker.AddToImports(javaMaker.Imports);
if (cfg.DebugLevel > 5) Console.Out.WriteLine("Translating {0} Net Calls to Java", javaFName);
NetMaker.compilation_unit_return javaCompilationUnit = netMaker.compilation_unit();

View File

@ -221,7 +221,7 @@ namespace Twiglet.CS2J.Translator.Transform
}
}
public void AddToImports(ICollection<string> imps) {
public void AddToImports(IEnumerable<string> imps) {
if (imps != null) {
foreach (string imp in imps) {
AddToImports(imp);

View File

@ -8,7 +8,7 @@ using System.Collections.Generic;
namespace Twiglet.CS2J.Translator.Utils
{
public class Set<T> : IEnumerable
public class Set<T> : IEnumerable<T>
{
///
@ -24,7 +24,12 @@ namespace Twiglet.CS2J.Translator.Utils
}
public IEnumerator GetEnumerator()
public IEnumerator<T> GetEnumerator()
{
return setD.Keys.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return setD.Keys.GetEnumerator();
}