From 0b0d8776f92c54adc14f8087bee83245c24d4b0e Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 27 Jan 2020 11:25:32 -0800 Subject: [PATCH 1/2] Properly tag Module in Tsx and TypeScript --- semantic-tsx/src/Language/TSX/Tags.hs | 15 ++++++++++++++- .../src/Language/TypeScript/Tags.hs | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/semantic-tsx/src/Language/TSX/Tags.hs b/semantic-tsx/src/Language/TSX/Tags.hs index e063acfd7..ade3bc2c4 100644 --- a/semantic-tsx/src/Language/TSX/Tags.hs +++ b/semantic-tsx/src/Language/TSX/Tags.hs @@ -100,6 +100,19 @@ instance ToTags Tsx.Class where } = yieldTag text Class loc byteRange >> gtags t tags t = gtags t +instance ToTags Tsx.Module where + tags t@Tsx.Module + { ann = loc@Loc { byteRange } + , name + } = match name + where + match expr = case expr of + Prj Tsx.Identifier { text } -> yield text + -- TODO: Handle NestedIdentifiers and Strings + -- Prj Tsx.NestedIdentifier { extraChildren } -> match + _ -> gtags t + yield text = yieldTag text Module loc byteRange >> gtags t + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -222,7 +235,7 @@ instance ToTags Tsx.MemberExpression instance ToTags Tsx.MetaProperty -- instance ToTags Tsx.MethodDefinition instance ToTags Tsx.MethodSignature -instance ToTags Tsx.Module +-- instance ToTags Tsx.Module instance ToTags Tsx.NamedImports instance ToTags Tsx.NamespaceImport instance ToTags Tsx.NestedIdentifier diff --git a/semantic-typescript/src/Language/TypeScript/Tags.hs b/semantic-typescript/src/Language/TypeScript/Tags.hs index 0f5fea56c..e36b28285 100644 --- a/semantic-typescript/src/Language/TypeScript/Tags.hs +++ b/semantic-typescript/src/Language/TypeScript/Tags.hs @@ -93,6 +93,19 @@ instance ToTags Ts.CallExpression where _ -> gtags t yield name = yieldTag name Call loc byteRange >> gtags t +instance ToTags Ts.Module where + tags t@Ts.Module + { ann = loc@Loc { byteRange } + , name + } = match name + where + match expr = case expr of + Prj Ts.Identifier { text } -> yield text + -- TODO: Handle NestedIdentifiers and Strings + -- Prj Tsx.NestedIdentifier { extraChildren } -> match + _ -> gtags t + yield text = yieldTag text Module loc byteRange >> gtags t + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -215,7 +228,7 @@ instance ToTags Ts.MemberExpression instance ToTags Ts.MetaProperty -- instance ToTags Ts.MethodDefinition instance ToTags Ts.MethodSignature -instance ToTags Ts.Module +-- instance ToTags Ts.Module instance ToTags Ts.NamedImports instance ToTags Ts.NamespaceImport instance ToTags Ts.NestedIdentifier From 66f7e6a57ac790a640c9fca66a78e31cadca2564 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 27 Jan 2020 12:35:11 -0800 Subject: [PATCH 2/2] Bump cache key for builds --- .github/workflows/haskell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index e1d1ed4b6..a1ff30ef2 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -37,7 +37,7 @@ jobs: name: Cache ~/.cabal/store with: path: ~/.cabal/store - key: ${{ runner.os }}-${{ matrix.ghc }}-v3-cabal-store + key: ${{ runner.os }}-${{ matrix.ghc }}-v4-cabal-store - uses: actions/cache@v1 name: Cache dist-newstyle