Skip to content

Commit

Permalink
Set scope information for JavaScript tags
Browse files Browse the repository at this point in the history
Instead of adding the scope to the tag name, properly add it as the
tag's scope.

Closes #3570192.
  • Loading branch information
b4n committed Sep 21, 2012
1 parent 2d83a85 commit 877b047
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
35 changes: 12 additions & 23 deletions tagmanager/ctags/js.c
Expand Up @@ -212,7 +212,7 @@ static void deleteToken (tokenInfo *const token)
* Tag generation functions
*/

static void makeConstTag (tokenInfo *const token, const jsKind kind)
static void makeJsTag (tokenInfo *const token, const jsKind kind)
{
if (JsKinds [kind].enabled && ! token->ignoreTag )
{
Expand All @@ -225,31 +225,20 @@ static void makeConstTag (tokenInfo *const token, const jsKind kind)
e.kindName = JsKinds [kind].name;
e.kind = JsKinds [kind].letter;

makeTagEntry (&e);
}
}

static void makeJsTag (tokenInfo *const token, const jsKind kind)
{
vString * fulltag;

if (JsKinds [kind].enabled && ! token->ignoreTag )
{
/*
* If a scope has been added to the token, change the token
* string to include the scope when making the tag.
*/
if ( vStringLength(token->scope) > 0 )
{
fulltag = vStringNew ();
vStringCopy(fulltag, token->scope);
vStringCatS (fulltag, ".");
vStringCatS (fulltag, vStringValue(token->string));
vStringTerminate(fulltag);
vStringCopy(token->string, fulltag);
vStringDelete (fulltag);
jsKind parent_kind = JSTAG_CLASS;

/* if we're creating a function (and not a method),
* guess we're inside another function */
if (kind == JSTAG_FUNCTION)
parent_kind = JSTAG_FUNCTION;

e.extensionFields.scope[0] = JsKinds [parent_kind].name;
e.extensionFields.scope[1] = vStringValue (token->scope);
}
makeConstTag (token, kind);

makeTagEntry (&e);
}
}

Expand Down
3 changes: 2 additions & 1 deletion tagmanager/src/tm_tag.c
Expand Up @@ -154,7 +154,8 @@ gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_ent
tag->atts.entry.arglist = g_strdup(tag_entry->extensionFields.arglist);
if ((NULL != tag_entry->extensionFields.scope[1]) &&
(isalpha(tag_entry->extensionFields.scope[1][0]) ||
tag_entry->extensionFields.scope[1][0] == '_'))
tag_entry->extensionFields.scope[1][0] == '_' ||
tag_entry->extensionFields.scope[1][0] == '$'))
tag->atts.entry.scope = g_strdup(tag_entry->extensionFields.scope[1]);
if (tag_entry->extensionFields.inheritance != NULL)
tag->atts.entry.inheritance = g_strdup(tag_entry->extensionFields.inheritance);
Expand Down

0 comments on commit 877b047

Please sign in to comment.