From df67185b45fa047bfa236314e8a68610ba527c95 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 16 Jul 2014 16:40:49 +0200 Subject: [PATCH] Fehler beim Umwandeln von Generischen Variablen zu TPH beseitigt --- src/mycompiler/mytype/GenericTypeVar.java | 2 +- src/mycompiler/mytype/TypePlaceholder.java | 23 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/mycompiler/mytype/GenericTypeVar.java b/src/mycompiler/mytype/GenericTypeVar.java index 6d2d9df78..0bac78075 100755 --- a/src/mycompiler/mytype/GenericTypeVar.java +++ b/src/mycompiler/mytype/GenericTypeVar.java @@ -182,7 +182,7 @@ public class GenericTypeVar extends Type public TypePlaceholder getTypePlaceHolder() { if(!GenericTypeVar.tph.containsKey(this)){ - GenericTypeVar.tph.put(this, TypePlaceholder.fresh()); + GenericTypeVar.tph.put(this, TypePlaceholder.fresh(this.getName())); } return GenericTypeVar.tph.get(this); //if(this.tph == null)this.tph = TypePlaceholder.fresh(); diff --git a/src/mycompiler/mytype/TypePlaceholder.java b/src/mycompiler/mytype/TypePlaceholder.java index c53974ab5..aab6d4da8 100755 --- a/src/mycompiler/mytype/TypePlaceholder.java +++ b/src/mycompiler/mytype/TypePlaceholder.java @@ -89,7 +89,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider * Variablen.
Author: J�rg B�uerle * @return Die TypePlaceholder */ - // ino.end + // ino.end // ino.method.fresh.26800.definition public static TypePlaceholder fresh() // ino.end @@ -101,6 +101,27 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider } // ino.end + /** + * Generiert einen neuen TPH mit einem bestimmten Namen. + * Wird benötigt, wenn aus Generischen Variablen TPH generiert werden. + * @param name + * @return + */ + public static TypePlaceholder fresh(String name) + // ino.end + // ino.method.fresh.26800.body + { + TypePlaceholder typeVar = new TypePlaceholder(name); + TypePlaceholder oldTPH = m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); + if(oldTPH != null){ + oldTPH.name = makeNewName(); + m_TypePlaceholdersRegistry.put(oldTPH.getName(), oldTPH); + } + return typeVar; + } + // ino.end + + /** * @author Andreas Stadelmeier, a10023 * Ruft die TypePlaceholder.fresh()-Methode auf.