covariant and override attributes better name

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7196 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-05-20 22:32:34 +00:00
commit 7a72389977
3 changed files with 13 additions and 13 deletions

View file

@ -1542,15 +1542,15 @@ class CSHARP : public Language {
/* Get return types */ /* Get return types */
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
// Note that in the case of polymorphic (covariant) return types, the method's return type is changed to be the base of the C++ return type // Note that in the case of polymorphic (covariant) return types, the method's return type is changed to be the base of the C++ return type
SwigType *virtualtype = Getattr(n,"virtual:type"); SwigType *covariant = Getattr(n,"covariant");
String *cstypeout = Getattr(n,"tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap String *cstypeout = Getattr(n,"tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap
if (cstypeout) if (cstypeout)
tm = cstypeout; tm = cstypeout;
substituteClassname(virtualtype ? virtualtype : t, tm); substituteClassname(covariant ? covariant : t, tm);
Printf(return_type, "%s", tm); Printf(return_type, "%s", tm);
if (virtualtype) if (covariant)
Swig_warning(WARN_CSHARP_COVARIANT_RET, input_file, line_number, Swig_warning(WARN_CSHARP_COVARIANT_RET, input_file, line_number,
"Covariant return types not supported in C#. Proxy method will return %s.\n", SwigType_str(virtualtype,0)); "Covariant return types not supported in C#. Proxy method will return %s.\n", SwigType_str(covariant,0));
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number,
"No cstype typemap defined for %s\n", SwigType_str(t,0)); "No cstype typemap defined for %s\n", SwigType_str(t,0));
@ -1573,7 +1573,7 @@ class CSHARP : public Language {
Printf(function_code, " %s ", methodmods); Printf(function_code, " %s ", methodmods);
if (static_flag) if (static_flag)
Printf(function_code, "static "); Printf(function_code, "static ");
if (Getattr(n,"virtual:derived")) if (Getattr(n,"override"))
Printf(function_code, "override "); Printf(function_code, "override ");
else if (checkAttribute(n, "storage", "virtual")) else if (checkAttribute(n, "storage", "virtual"))
Printf(function_code, "virtual "); Printf(function_code, "virtual ");

View file

@ -1831,12 +1831,12 @@ class JAVA : public Language {
/* Get return types */ /* Get return types */
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) {
// Note that in the case of polymorphic (covariant) return types, the method's return type is changed to be the base of the C++ return type // Note that in the case of polymorphic (covariant) return types, the method's return type is changed to be the base of the C++ return type
SwigType *virtualtype = Getattr(n,"virtual:type"); SwigType *covariant = Getattr(n,"covariant");
substituteClassname(virtualtype ? virtualtype : t, tm); substituteClassname(covariant ? covariant : t, tm);
Printf(return_type, "%s", tm); Printf(return_type, "%s", tm);
if (virtualtype) if (covariant)
Swig_warning(WARN_JAVA_COVARIANT_RET, input_file, line_number, Swig_warning(WARN_JAVA_COVARIANT_RET, input_file, line_number,
"Covariant return types not supported in Java. Proxy method will return %s.\n", SwigType_str(virtualtype,0)); "Covariant return types not supported in Java. Proxy method will return %s.\n", SwigType_str(covariant,0));
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No jstype typemap defined for %s\n", SwigType_str(t,0));
@ -3053,8 +3053,8 @@ class JAVA : public Language {
String *jdesc; String *jdesc;
SwigType *virtualtype = Getattr(n,"virtual:type"); SwigType *covariant = Getattr(n,"covariant");
SwigType *adjustedreturntype = virtualtype ? virtualtype : returntype; SwigType *adjustedreturntype = covariant ? covariant : returntype;
Parm *adjustedreturntypeparm = NewParmFromNode(adjustedreturntype, empty_str, n); Parm *adjustedreturntypeparm = NewParmFromNode(adjustedreturntype, empty_str, n);
if ((tm = Swig_typemap_lookup_new("directorin", adjustedreturntypeparm, "", 0)) != NULL if ((tm = Swig_typemap_lookup_new("directorin", adjustedreturntypeparm, "", 0)) != NULL

View file

@ -2785,7 +2785,7 @@ MODULA3 ():
*/ */
String *arguments = createM3Signature (n); String *arguments = createM3Signature (n);
String *storage = Getattr (n, "storage"); String *storage = Getattr (n, "storage");
String *overridden = Getattr (n, "virtual:derived"); String *overridden = Getattr (n, "override");
bool isVirtual = (storage != NIL) && (Strcmp (storage, "virtual") == 0); bool isVirtual = (storage != NIL) && (Strcmp (storage, "virtual") == 0);
bool isOverridden = (overridden != NIL) bool isOverridden = (overridden != NIL)
&& (Strcmp (overridden, "1") == 0); && (Strcmp (overridden, "1") == 0);
@ -2906,7 +2906,7 @@ MODULA3 ():
Getattr (n, "feature:modula3:methodmodifiers")); Getattr (n, "feature:modula3:methodmodifiers"));
if (static_flag) if (static_flag)
Printf (function_code, "static "); Printf (function_code, "static ");
if (Getattr (n, "virtual:derived")) if (Getattr (n, "override"))
Printf (function_code, "override "); Printf (function_code, "override ");
else if (checkAttribute (n, "storage", "virtual")) else if (checkAttribute (n, "storage", "virtual"))
Printf (function_code, "virtual "); Printf (function_code, "virtual ");