From: <bi...@us...> - 2015-06-27 18:11:42
|
Revision: 10950 http://sourceforge.net/p/oorexx/code-0/10950 Author: bigrixx Date: 2015-06-27 18:11:40 +0000 (Sat, 27 Jun 2015) Log Message: ----------- [#1341] Some classes have a lot more instance methods than expected Modified Paths: -------------- main/trunk/interpreter/behaviour/MethodDictionary.cpp main/trunk/interpreter/behaviour/MethodDictionary.hpp main/trunk/interpreter/behaviour/RexxBehaviour.cpp main/trunk/interpreter/messages/errnums.xml main/trunk/interpreter/platform/unix/rexx.cat main/trunk/interpreter/platform/windows/winmsgtb.rc Modified: main/trunk/interpreter/behaviour/MethodDictionary.cpp =================================================================== --- main/trunk/interpreter/behaviour/MethodDictionary.cpp 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/behaviour/MethodDictionary.cpp 2015-06-27 18:11:40 UTC (rev 10950) @@ -214,10 +214,9 @@ /** * Overlay a collection of methods on top of this dictionary. - * At this time, we're just adding the entries to the table. - * These will be updated with correct scopes later. * * @param source The source method dictionary. + * @param scope The scope the copied methods will have in the target dictionary. */ void MethodDictionary::replaceMethods(MethodDictionary *source, RexxClass *scope) { @@ -242,7 +241,43 @@ * Overlay a collection of methods on top of this dictionary. * * @param source The source method dictionary. + * @param filterScope + * The filtering scope for the inherit operations. Only methods + * defined at the filtering scope will be copied to the target + * method dictionary. + * + * @param scope The scope that will be assigned to the copied methods. */ +void MethodDictionary::replaceMethods(MethodDictionary *source, RexxClass *filterScope, RexxClass *scope) +{ + // use an iterator to traverse the table + HashContents::TableIterator iterator = source->iterator(); + + for (; iterator.isAvailable(); iterator.next()) + { + // copy these methods over any of our own. + MethodClass *method = (MethodClass *)iterator.value(); + RexxString *name = (RexxString *)iterator.index(); + if (isMethod(method)) + { + // we're working off of a merged method dictionary, so only take the + // ones from target scope + if (method->getScope() != filterScope) + { + continue; + } + method = method->newScope(scope); + } + replaceMethod(name, method); + } +} + + +/** + * Overlay a collection of methods on top of this dictionary. + * + * @param source The source method dictionary. + */ void MethodDictionary::replaceMethods(StringTable *source, RexxClass *scope) { // use an iterator to traverse the table Modified: main/trunk/interpreter/behaviour/MethodDictionary.hpp =================================================================== --- main/trunk/interpreter/behaviour/MethodDictionary.hpp 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/behaviour/MethodDictionary.hpp 2015-06-27 18:11:40 UTC (rev 10950) @@ -70,6 +70,7 @@ void addMethod(RexxString *methodName, MethodClass *method); void replaceMethod(RexxString *methodName, MethodClass *method); void replaceMethods(MethodDictionary *source, RexxClass *scope); + void replaceMethods(MethodDictionary *source, RexxClass *filterScope, RexxClass *scope); void replaceMethods(StringTable *source, RexxClass *scope); void addMethods(StringTable *source, RexxClass *scope); bool removeMethod(RexxString *methodName); Modified: main/trunk/interpreter/behaviour/RexxBehaviour.cpp =================================================================== --- main/trunk/interpreter/behaviour/RexxBehaviour.cpp 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/behaviour/RexxBehaviour.cpp 2015-06-27 18:11:40 UTC (rev 10950) @@ -346,7 +346,7 @@ // have this merge all of the methods from the other dictionary into // ours. This will replace any existing methods (although we generally // only use this on an empty dictionary). - methodDictionary->replaceMethods(source->getMethodDictionary(), getOwningClass()); + methodDictionary->replaceMethods(source->getMethodDictionary(), source->getOwningClass(), getOwningClass()); } Modified: main/trunk/interpreter/messages/errnums.xml =================================================================== --- main/trunk/interpreter/messages/errnums.xml 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/messages/errnums.xml 2015-06-27 18:11:40 UTC (rev 10950) @@ -814,7 +814,7 @@ <varlistentry> <term>919</term> <listitem> -<para>Symbol expected as ::ANNOTATION attribute name; found "<emphasis role="italic">name</emphasis>".</para> +<para>Symbol expected as ::ANNOTATE attribute name; found "<emphasis role="italic">name</emphasis>".</para> </listitem> </varlistentry> <varlistentry> Modified: main/trunk/interpreter/platform/unix/rexx.cat =================================================================== --- main/trunk/interpreter/platform/unix/rexx.cat 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/platform/unix/rexx.cat 2015-06-27 18:11:40 UTC (rev 10950) @@ -1875,7 +1875,7 @@ 756 Value of expression following WHEN keyword must be exactly "0" or "1"; found "&1". $ Error_Symbol_expected_annotation_attribute -757 Symbol expected as ::ANNOTATION attribute name; found "&1". +757 Symbol expected as ::ANNOTATE attribute name; found "&1". $ Error_Symbol_or_string_package_attribute_bad_value 758 Symbol or string expected as ::ANNOTATE attribute value; found "&1". Modified: main/trunk/interpreter/platform/windows/winmsgtb.rc =================================================================== --- main/trunk/interpreter/platform/windows/winmsgtb.rc 2015-06-27 10:41:26 UTC (rev 10949) +++ main/trunk/interpreter/platform/windows/winmsgtb.rc 2015-06-27 18:11:40 UTC (rev 10950) @@ -660,7 +660,7 @@ 34905 "SELECT CASE comparison result must be ""0"", ""1"", ""true"", or ""false""; found ""&1""." 35934 "Missing expression in WHEN case expression list." 34002 "Value of expression following WHEN keyword must be exactly ""0"" or ""1""; found ""&1""." - 20919 "Symbol expected as ::ANNOTATION attribute name; found ""&1""." + 20919 "Symbol expected as ::ANNOTATE attribute name; found ""&1""." 19923 "Symbol or string expected as ::ANNOTATE attribute value; found ""&1""." 19924 "Symbol or string expected as ::ANNOTATE attribute value." 19925 "Symbol or string expected after &1 &2 keyword." |