Refactor checks/use of ':' with name attribute
This commit is contained in:
parent
e4f56a8ed5
commit
0343a01a8c
1 changed files with 4 additions and 30 deletions
|
|
@ -1367,15 +1367,14 @@ public:
|
||||||
wname = getWrapperMethodName(class_name, iname);
|
wname = getWrapperMethodName(class_name, iname);
|
||||||
} else if (wrapperType == globalvar) {
|
} else if (wrapperType == globalvar) {
|
||||||
//check for namespaces (global class vars)
|
//check for namespaces (global class vars)
|
||||||
String *nameSpace = getNameSpace(GetChar(n, "name"));
|
if (Strchr(name,':')) {
|
||||||
if (nameSpace == NULL) {
|
|
||||||
wname = getWrapperMethodName(class_name, iname);
|
wname = getWrapperMethodName(class_name, iname);
|
||||||
} else {
|
} else {
|
||||||
wname = iname;
|
wname = iname;
|
||||||
}
|
}
|
||||||
} else if (wrapperType == staticmembervar) {
|
} else if (wrapperType == staticmembervar) {
|
||||||
// Shape::nshapes -> nshapes
|
// Shape::nshapes -> nshapes
|
||||||
wname = (String*) Char(Getattr(n, "staticmembervariableHandler:sym:name"));
|
wname = Getattr(n, "staticmembervariableHandler:sym:name");
|
||||||
|
|
||||||
/* We get called twice for getter and setter methods. But to maintain
|
/* We get called twice for getter and setter methods. But to maintain
|
||||||
compatibility, Shape::nshapes() is being used for both setter and
|
compatibility, Shape::nshapes() is being used for both setter and
|
||||||
|
|
@ -1390,11 +1389,7 @@ public:
|
||||||
static_getter = true;
|
static_getter = true;
|
||||||
}
|
}
|
||||||
} else if (wrapperType == staticmemberfn) {
|
} else if (wrapperType == staticmemberfn) {
|
||||||
if (Char(Strchr(name, ':'))) {
|
wname = Getattr(n, "staticmemberfunctionHandler:sym:name");
|
||||||
wname = getWrapperMethodName(class_name, iname);
|
|
||||||
} else {
|
|
||||||
wname = iname;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
wname = getWrapperMethodName(class_name, iname);
|
wname = getWrapperMethodName(class_name, iname);
|
||||||
|
|
@ -2636,9 +2631,7 @@ done:
|
||||||
|
|
||||||
if (Strchr(name,':') && class_name) {
|
if (Strchr(name,':') && class_name) {
|
||||||
isMemberConstant = true;
|
isMemberConstant = true;
|
||||||
char *ptr = Char(strrchr(GetChar(n, "name"),':')) + 1;
|
constant_name = getWrapperMethodName(class_name, iname);
|
||||||
constant_name = NewStringEmpty();
|
|
||||||
constant_name = (String*) ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addSymbol(iname, n))
|
if (!addSymbol(iname, n))
|
||||||
|
|
@ -2748,25 +2741,6 @@ done:
|
||||||
return Language::classDeclaration(n);
|
return Language::classDeclaration(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* class helper method to get namespace
|
|
||||||
*/
|
|
||||||
String *getNameSpace(char *name) {
|
|
||||||
String *present_name = NewString(name);
|
|
||||||
String *second_half = NewString(strchr(name, ':'));
|
|
||||||
Replace(present_name, second_half, "", DOH_REPLACE_FIRST);
|
|
||||||
return present_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper method to get names without namespace
|
|
||||||
*/
|
|
||||||
String *getNameWithoutNamespace(char *name) {
|
|
||||||
char *returnName = Char(strrchr(name, ':'));
|
|
||||||
if (!returnName) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return NewString(returnName + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* classHandler()
|
* classHandler()
|
||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue