Skip to content

Commit

Permalink
Convert hack.ModuleParent
Browse files Browse the repository at this point in the history
Reviewed By: donsbot

Differential Revision: D66014022

fbshipit-source-id: a28b40b75641b2279009303a38872c80fe18e558
  • Loading branch information
Simon Marlow authored and facebook-github-bot committed Dec 16, 2024
1 parent f3d2390 commit 858d59e
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions glean/schema/source/hack.angle
Original file line number Diff line number Diff line change
Expand Up @@ -734,23 +734,38 @@ predicate ModuleParent:
decl: hack.Declaration,
module: hack.ModuleDeclaration
}
{ Decl, Module } where
( { function_ = FunDecl } = Decl;
hack.FunctionDefinition { declaration = FunDecl, module_ = M } ) |
( { typedef_ = TyDecl } = Decl;
hack.TypedefDefinition { declaration = TyDecl, module_ = M }
{ Decl, M.just?.declaration } where
(
hack.FunctionDefinition D;
Decl.function_? = D.declaration;
M = D.module_;
) | (
hack.TypedefDefinition D;
Decl.typedef_? = D.declaration;
M = D.module_;
) | (
{ container = Container } = Decl;
( { class_ = CDecl } = Container;
hack.ClassDefinition { declaration = CDecl, module_ = M } ) |
( { enum_ = CDecl } = Container;
hack.EnumDefinition { declaration = CDecl, module_ = M } ) |
( { interface_ = CDecl } = Container;
hack.InterfaceDefinition { declaration = CDecl, module_ = M } ) |
( { trait = CDecl } = Container;
hack.TraitDefinition { declaration = CDecl, module_ = M } )
);
{ just = { Module, _ } } = M
Decl.container? = Container;
( Container.class_? = CDecl;
hack.ClassDefinition D;
D.declaration = CDecl;
D.module_ = M;
) | (
Container.enum_? = CDecl;
hack.EnumDefinition D;
D.declaration = CDecl;
D.module_ = M;
) | (
Container.interface_? = CDecl;
hack.InterfaceDefinition I;
I.declaration = CDecl;
I.module_ = M;
) | (
Container.trait? = CDecl;
hack.TraitDefinition T;
T.declaration = CDecl;
T.module_ = M;
)
)

# derive children decls that are members of a parent module
predicate ModuleChild:
Expand Down Expand Up @@ -796,8 +811,7 @@ predicate AttributeToDeclaration :
}
stored
{ Attr, Decl, File } where
{ name = Name } = Attr;
{ container = { class_ = { name = { name = Name } } } } = Decl;
Attr.name = Decl.container?.class_?.name.name;
DeclarationLocation { declaration = Decl, file = File };

# TODO qname for attributes aren't filled by the indexer yet
Expand Down

0 comments on commit 858d59e

Please sign in to comment.