Skip to content
Browse files

Set scope information for JavaScript tags

Instead of adding the scope to the tag name, properly add it as the
tag's scope.

Closes #3570192.
  • Loading branch information...
1 parent 2d83a85 commit 877b0477c401e9c359cbf93e04989b7aeccc257e @b4n b4n committed Sep 21, 2012
Showing with 14 additions and 24 deletions.
  1. +12 −23 tagmanager/ctags/js.c
  2. +2 −1 tagmanager/src/tm_tag.c
View
35 tagmanager/ctags/js.c
@@ -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 )
{
@@ -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);
}
}
View
3 tagmanager/src/tm_tag.c
@@ -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);

0 comments on commit 877b047

Please sign in to comment.
Something went wrong with that request. Please try again.