1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Rename to Info

This commit is contained in:
joshvera 2018-12-14 17:02:42 -05:00
parent 1ff058437c
commit 589ed82b76

View File

@ -188,7 +188,7 @@ insertReference ref path scope = scope { references = Map.insert ref path (refer
lookupDeclaration :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Data scopeAddress, Position) lookupDeclaration :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Data scopeAddress, Position)
lookupDeclaration name scope g = do lookupDeclaration name scope g = do
dataSeq <- ddataOfScope scope g dataSeq <- ddataOfScope scope g
index <- Seq.findIndexR (\Data{..} -> Declaration name == dataDeclaration) dataSeq index <- Seq.findIndexR (\Info{..} -> Declaration name == dataDeclaration) dataSeq
(, Position index) <$> Seq.lookup index dataSeq (, Position index) <$> Seq.lookup index dataSeq
declarationNames :: Ord address => [EdgeLabel] -> Scope address -> ScopeGraph address -> Set Declaration declarationNames :: Ord address => [EdgeLabel] -> Scope address -> ScopeGraph address -> Set Declaration
@ -201,7 +201,7 @@ declarationNames edgeLabels scope scopeGraph = localDeclarations <> edgeNames
putDeclarationScopeAtPosition :: Ord scopeAddress => scopeAddress -> Position -> Maybe scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress putDeclarationScopeAtPosition :: Ord scopeAddress => scopeAddress -> Position -> Maybe scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress
putDeclarationScopeAtPosition scope position assocScope g@(ScopeGraph graph) = fromMaybe g $ do putDeclarationScopeAtPosition scope position assocScope g@(ScopeGraph graph) = fromMaybe g $ do
dataSeq <- ddataOfScope scope g dataSeq <- ddataOfScope scope g
let seq = Seq.adjust' (\Data{..} -> Data dataDeclaration dataRelation dataSpan assocScope) (unPosition position) dataSeq let seq = Seq.adjust' (\Info{..} -> Info { dataAssociatedScope = assocScope, .. }) (unPosition position) dataSeq
pure $ ScopeGraph (Map.adjust (\s -> s { declarations = seq }) scope graph) pure $ ScopeGraph (Map.adjust (\s -> s { declarations = seq }) scope graph)
lookupReference :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) lookupReference :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress)