Check the protected constructor case. They don't get into the director.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5486 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2003-12-05 06:08:54 +00:00
commit 8accb4c083

View file

@ -323,13 +323,21 @@ static void add_symbols(Node *n) {
}
while (n) {
String *symname;
if (inclass && (cplus_mode == CPLUS_PROTECTED)) {
if (Strcmp(nodeType(n),"constructor") == 0) {
if (!Getattr(n,"access")) {
Swig_symbol_add(0, n); /* Add to C symbol table */
Setattr(n,"access", "protected");
}
n = nextSibling(n);
continue;
}
Setattr(n,"access", "protected");
}
if (Getattr(n,"sym:name")) {
n = nextSibling(n);
continue;
}
if (cplus_mode == CPLUS_PROTECTED) {
Setattr(n,"access", "protected");
}
decl = Getattr(n,"decl");
if (!SwigType_isfunction(decl)) {
symname = make_name(Getattr(n,"name"),0);
@ -3509,11 +3517,9 @@ def_args : EQUAL definetype {
Node *n = Swig_symbol_clookup($3.id,0);
if (n) {
String *q = Swig_symbol_qualified(n);
String *a = Getattr(n,"access");
if (a && (Strncmp(a,"private",7) == 0)) {
if (cplus_mode != CPLUS_PRIVATE) {
Swig_warning(WARN_PARSE_PRIVATE, cparse_file,
cparse_line,"'%s' is %s in this context.\n", q, a);
if (Getattr(n,"access")) {
if (cplus_mode == CPLUS_PUBLIC) {
Swig_warning(WARN_PARSE_PRIVATE, cparse_file, cparse_line,"'%s' is private in this context.\n", $3.id);
Swig_warning(WARN_PARSE_BAD_DEFAULT, cparse_file, cparse_line,"Can't set default argument value (ignored)\n");
}
$$.val = 0;
@ -4319,9 +4325,7 @@ expr : exprnum { $$ = $1; }
/* Check if value is in scope */
n = Swig_symbol_clookup($1,0);
if (n) {
String *a = Getattr(n,"access");
if (a && (Strncmp(a, "private", 7) == 0)
&& (cplus_mode != CPLUS_PRIVATE)) {
if (Getattr(n,"access") && (cplus_mode == CPLUS_PUBLIC)) {
Swig_warning(WARN_PARSE_PRIVATE,cparse_file, cparse_line, "'%s' is private in this context.\n", $1);
$$.type = T_ERROR;
} else {