ruby: Report proper scope type
This commit is contained in:
parent
9e97746751
commit
7d116cb482
@ -170,6 +170,8 @@ static void emitRubyTag (vString* name, rubyKind kind)
|
|||||||
{
|
{
|
||||||
tagEntryInfo tag;
|
tagEntryInfo tag;
|
||||||
vString* scope;
|
vString* scope;
|
||||||
|
rubyKind parent_kind = K_UNDEFINED;
|
||||||
|
NestingLevel *lvl;
|
||||||
const char *unqualified_name;
|
const char *unqualified_name;
|
||||||
const char *qualified_name;
|
const char *qualified_name;
|
||||||
|
|
||||||
@ -179,6 +181,9 @@ static void emitRubyTag (vString* name, rubyKind kind)
|
|||||||
|
|
||||||
vStringTerminate (name);
|
vStringTerminate (name);
|
||||||
scope = nestingLevelsToScope (nesting);
|
scope = nestingLevelsToScope (nesting);
|
||||||
|
lvl = nestingLevelsGetCurrent (nesting);
|
||||||
|
if (lvl)
|
||||||
|
parent_kind = lvl->type;
|
||||||
|
|
||||||
qualified_name = vStringValue (name);
|
qualified_name = vStringValue (name);
|
||||||
unqualified_name = strrchr (qualified_name, SCOPE_SEPARATOR);
|
unqualified_name = strrchr (qualified_name, SCOPE_SEPARATOR);
|
||||||
@ -190,6 +195,8 @@ static void emitRubyTag (vString* name, rubyKind kind)
|
|||||||
vStringPut (scope, SCOPE_SEPARATOR);
|
vStringPut (scope, SCOPE_SEPARATOR);
|
||||||
vStringNCatS (scope, qualified_name,
|
vStringNCatS (scope, qualified_name,
|
||||||
unqualified_name - qualified_name);
|
unqualified_name - qualified_name);
|
||||||
|
/* assume module parent type for a lack of a better option */
|
||||||
|
parent_kind = K_MODULE;
|
||||||
}
|
}
|
||||||
unqualified_name++;
|
unqualified_name++;
|
||||||
}
|
}
|
||||||
@ -198,7 +205,10 @@ static void emitRubyTag (vString* name, rubyKind kind)
|
|||||||
|
|
||||||
initTagEntry (&tag, unqualified_name);
|
initTagEntry (&tag, unqualified_name);
|
||||||
if (vStringLength (scope) > 0) {
|
if (vStringLength (scope) > 0) {
|
||||||
tag.extensionFields.scope [0] = "class";
|
Assert (0 <= parent_kind &&
|
||||||
|
(size_t) parent_kind < (sizeof RubyKinds / sizeof RubyKinds[0]));
|
||||||
|
|
||||||
|
tag.extensionFields.scope [0] = RubyKinds [parent_kind].name;
|
||||||
tag.extensionFields.scope [1] = vStringValue (scope);
|
tag.extensionFields.scope [1] = vStringValue (scope);
|
||||||
}
|
}
|
||||||
tag.kindName = RubyKinds [kind].name;
|
tag.kindName = RubyKinds [kind].name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user