Repository navigation
fix(definitions): recognize export macros, open typedef bodies, top-level prototypes, and namespace re-exports - #932
dmtrKovalenko wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
2e449b8 to
16e1765
Compare
206f796 to
933e257
Compare
933e257 to
9f0a46f
Compare
9f0a46f to
6ad121d
Compare
…evel prototypes, and namespace re-exports The C grammar skips all-caps export macros before a type name, keeps the struct tag when a typedef body continues on later lines, and accepts one-line prototypes at the top level or after a modifier. JavaScript maps `as` to an Alias rule, so `export * as Name from` defines Name.
…eywords Indented one-line declarations count only after virtual or explicit, so locals built with arguments stay out. A parenthesised attribute before a typedef tag is skipped, and asm, volatile, __attribute__, __declspec and alignas are never declared names.
6ad121d to
51b755b
Compare
The C grammar now names C++ classes after export macros, keeps the struct tag when a typedef body continues on later lines, and accepts one-line prototypes at the top level or after a modifier. The JavaScript grammar maps
asto anAliasrule, soexport * as Name fromdefinesName.class BASE_EXPORT CommandLine {CommandLinestruct COMPONENT_EXPORT(NETWORK_CPP) Foo {Footypedef struct AVCodecContext {(body on later lines)AVCodecContextint av_read_frame(AVFormatContext *s, AVPacket *pkt);av_read_framevirtual void OnChanged(const Event& event);OnChangedexport * as SessionRetry from "./retry"SessionRetryret = av_read_frame(s, pkt);,static DEFINE_MUTEX(lock);count * sizeof(T)sizeofThe rules stay in the grammar tables and generated checkers:
languages.rsmaps the JavaScript keywordasto a newAliasaction inrules.rs.C_TYPEbranch ofdeclaration_nameskips all-caps export macros.c_functionaccepts);only at column 0 or after a grammar modifier, and never for an all-caps macro call.Classifier latency per matched line, best of 7 passes over the same samples:
libavcodec,libavformat,libavutil, Chromiumbase)srcfolders)On the C/C++ corpus the classifier finds 86,050 definitions instead of 76,706. TypeScript gains every
export * asre-export.Note
Indented C++ member declarations without a modifier, such as
void MaybeComplete();, stay unclassified, as onmain. The out-of-line definition in the.ccfile is classified.Stacked on #931.
Stack merge order: #924, #925, #927, #928, #930, #931, #932, #940, #933, #934.
Summary by CodeRabbit
@This()declarations.