class Block; class Context; class Expression; class IndexExpression; class Position; class ProgramUsage; class SymbolTable; class Variable; enumclass ProgramKind : int8_t; struct Module; struct Program;
/** Replaces constant variables in a program with their equivalent values. */ void ReplaceConstVarsWithLiterals(Module& module, ProgramUsage* usage);
/** *Looksforvariablesinsideofthetop-levelofswitch-cases,suchas: * *case1:inti;// `i` is at top-level *case2:floatf=5.0;// `f` is at top-level, and has an initial-value assignment *case3:{boolb;}// `b` is not at top-level; it has an additional scope * *Ifanytop-levelvariablesarefound,ascopedblockiscreatedandreturnedwhichholdsthe *variabledeclarationsfromtheswitch-casesandintotheouterscope.(Variableswithadditional *scopingareleftas-is.)Then,wereplacethedeclarationswithnopsorassignmentstatements. *Thatis,wewouldreturnaBlocklikethis: * *{ *inti; *floatf; *} * *Andwewouldalsomutatethepassed-incasestatementstoeliminatethevariabledecarations: * *case1:Nop;// `i` is declared in the returned block and needs no initialization *case2:f=5.0;// `f` is declared in the returned block and initialized here *case3:{boolb;}// `b` is left as-is because it has a block-scope * *Thisdoesn'tchangethemeaningorcorrectnessofthecode.Iftheswitchneedstoberewriten *(e.g.duetotherestrictionsofES2orWGSL),thistransformationpreventsscopingissueswith *variablesfallingoutofscopebetweenswitch-caseswhenwefallthrough. * *Iftherearenovariablesatthetop-level,nullisreturned.
*/
std::unique_ptr<Block> HoistSwitchVarDeclarationsAtTopLevel(const Context&, StatementArray& cases,
SymbolTable& symbolTable, Position pos);
} // namespace Transform
} // namespace SkSL
#endif
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.