1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Merge pull request #433 from github/ruby-has-methods

Classify methods properly
This commit is contained in:
Timothy Clem 2020-01-21 16:30:45 -07:00 committed by GitHub
commit f4fbf51f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

View File

@ -27,6 +27,12 @@ jobs:
ghc-version: ${{ matrix.ghc }} ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }} cabal-version: ${{ matrix.cabal }}
- uses: actions/cache@v1
name: Cache ~/.cabal/packages
with:
path: ~/.cabal/packages
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages
- uses: actions/cache@v1 - uses: actions/cache@v1
name: Cache ~/.cabal/store name: Cache ~/.cabal/store
with: with:
@ -39,17 +45,17 @@ jobs:
path: dist-newstyle path: dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-semantic-dist key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-semantic-dist
# - name: hlint
# run: |
# test -f dist-newstyle/hlint || cabal install hlint --installdir=dist-newstyle
# dist-newstyle/hlint src semantic-python
- name: Install dependencies - name: Install dependencies
run: | run: |
cabal v2-update cabal v2-update
cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2 cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
cabal v2-build --project-file=cabal.project.ci all --only-dependencies cabal v2-build --project-file=cabal.project.ci all --only-dependencies
- name: hlint
run: |
test -f dist-newstyle/hlint || cabal install hlint --installdir=dist-newstyle
dist-newstyle/hlint src semantic-python
- name: Build & test - name: Build & test
run: | run: |
cabal v2-build --project-file=cabal.project.ci cabal v2-build --project-file=cabal.project.ci

View File

@ -47,7 +47,7 @@ instance ToTags Go.MethodDeclaration where
tags t@Go.MethodDeclaration tags t@Go.MethodDeclaration
{ ann = loc@Loc { byteRange } { ann = loc@Loc { byteRange }
, name = Go.FieldIdentifier { text } , name = Go.FieldIdentifier { text }
} = yieldTag text Function loc byteRange >> gtags t } = yieldTag text Method loc byteRange >> gtags t
instance ToTags Go.CallExpression where instance ToTags Go.CallExpression where
tags t@Go.CallExpression tags t@Go.CallExpression

View File

@ -147,7 +147,7 @@ yieldMethodNameTag t loc range (Rb.MethodName expr) = enterScope True $ case exp
-- Prj Rb.Symbol { extraChildren = [Prj Rb.EscapeSequence { text = name }] } -> yield name -- Prj Rb.Symbol { extraChildren = [Prj Rb.EscapeSequence { text = name }] } -> yield name
_ -> gtags t _ -> gtags t
where where
yield name = yieldTag name Function loc range >> gtags t yield name = yieldTag name Method loc range >> gtags t
enterScope :: (Has (State [Text]) sig m) => Bool -> m () -> m () enterScope :: (Has (State [Text]) sig m) => Bool -> m () -> m ()
enterScope createNew m = do enterScope createNew m = do

View File

@ -67,7 +67,7 @@ instance ToTags Tsx.MethodDefinition where
-- TODO: There are more here -- TODO: There are more here
_ -> gtags t _ -> gtags t
where where
yield name = yieldTag name Call loc byteRange >> gtags t yield name = yieldTag name Method loc byteRange >> gtags t
instance ToTags Tsx.ClassDeclaration where instance ToTags Tsx.ClassDeclaration where
tags t@Tsx.ClassDeclaration tags t@Tsx.ClassDeclaration

View File

@ -67,7 +67,7 @@ instance ToTags Ts.MethodDefinition where
-- TODO: There are more here -- TODO: There are more here
_ -> gtags t _ -> gtags t
where where
yield name = yieldTag name Call loc byteRange >> gtags t yield name = yieldTag name Method loc byteRange >> gtags t
instance ToTags Ts.ClassDeclaration where instance ToTags Ts.ClassDeclaration where
tags t@Ts.ClassDeclaration tags t@Ts.ClassDeclaration