Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: extend mixin field #2481

Merged
merged 2 commits into from
Apr 2, 2020
Merged

Conversation

AmaiKinono
Copy link
Member

The solution developed in #2478 is extended to deal with "prepend" and "extend" methods.

One thing I've noticed is include, prepend and extend are all methods, so it's valid to write:

class A
  prepend(X)
end

But it's not handled by current scheme.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.001%) to 86.71% when pulling db63ee3 on AmaiKinono:ruby-mixin into 6c50aae on universal-ctags:master.

@codecov
Copy link

codecov bot commented Apr 2, 2020

Codecov Report

Merging #2481 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2481   +/-   ##
=======================================
  Coverage   86.60%   86.60%           
=======================================
  Files         177      177           
  Lines       36759    36763    +4     
=======================================
+ Hits        31835    31839    +4     
  Misses       4924     4924           
Impacted Files Coverage Δ
parsers/ruby.c 98.03% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c50aae...db63ee3. Read the comment docs.

@masatake masatake merged commit 7d81c52 into universal-ctags:master Apr 2, 2020
@masatake
Copy link
Member

masatake commented Apr 2, 2020

Thank you!

@masatake
Copy link
Member

masatake commented Apr 2, 2020

class A
  prepend(X)
end

This can be captured with:

[yamato@slave]~/var/ctags-github% git diff parsers/ruby.c
diff --git a/parsers/ruby.c b/parsers/ruby.c
index f6ac449c..b6d465b2 100644
--- a/parsers/ruby.c
+++ b/parsers/ruby.c
@@ -476,8 +476,13 @@ static void readAndStoreMixinSpec (const unsigned char** cp, const char *how_mix
    if (! (e->kindIndex == K_CLASS || e->kindIndex == K_MODULE))
        return;

-   if (isspace (**cp))
+   if (isspace (**cp) || (**cp == '('))
    {
+       if (isspace (**cp))
+           skipWhitespace (cp);
+       if (**cp == '(')
+           ++*cp;
+
        vString *spec = vStringNewInit (how_mixin);
        vStringPut(spec, ':');

I will make a pull request for this after merging #2482.

@AmaiKinono AmaiKinono deleted the ruby-mixin branch April 2, 2020 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants