CKCodeGenPipeline Flashcards
What’s in Specs.h?
Contains props/state used by the component spec. Imported by the corresponding Specs.mm file
What’s in Specs.mm?
Imports SpecInternals.h, Specs.h
Defines a function annotated by CK_RENDER
Can contain CK_STATE_UPDATE annotated functions
How do we perform state updates in CKCG?
Declare a function returning void, taking a single State & parameter, arbitrarily named, but annotated by CK_STATE_UPDATE.
What happens to functions annotated by CK_STATE_UPDATE
void (State &state) gets transformed into void invoke.
What is the signature of the updateState function
?
What is the point of the updateState function
?
When are components redrawn?
On receiving a message, a new component tree is conceptually created; the diff with the old generation is taken, and only components that have changed are recreated. A functional concept – take props as input, and produce components as output.
How do we run CKCG?
(1) Buck takes flags which make it find all paths ending in Spec.mm – it treats these specially as component specs.
(2) Clang is then invoked on the specs, with three (?) command line flags (compilation DB, header namespace, out path)
What does clang initially do with the three command line args?
Extract flags (+mutuate them for some complex reason) Send to parsing module (mainly clang implemented) produces cAST as output
What does the parsing module do?
Invoke libclang to produce a translation unit
Produce an AST from the translation unit
Send to Validation module
What does the Validation module do?
Find the CK_RENDER function.
Generate a Validation::Spec
Create a Generation::Spec (invoke generation module)
What does the Generation module do?
Check if the component isStateless
Generate Component.h, Component.mm, SpecInternal.h
Why is isStateless in the generation module poor nomenclature?
?
What’s in SpecInternal.h for a particular spec?
?