@@ -229,7 +229,8 @@ std::string pass_as_string(T&& v) {
229229` ) ;
230230
231231 if ( this . #stringTable) {
232- implContent . push ( `#include "${ includePathPrefix } /string_table.h"` ) ;
232+ const hash = templateImplementationHash . get ( "string_table.h" ) ;
233+ implContent . push ( `#include "${ includePathPrefix } /string_table.h" // ${ hash } ` ) ;
233234 }
234235 implContent . push ( "" ) ;
235236 implContent . push ( "// Include template implementations" ) ;
@@ -241,12 +242,6 @@ std::string pass_as_string(T&& v) {
241242 }
242243 const baseName = name . slice ( 0 , - templateExt . length ) ;
243244 const hash = templateImplementationHash . get ( name ) ;
244- if ( ! hash ) {
245- throw new WgslTemplateBuildError (
246- `Missing hash for template implementation "${ name } "` ,
247- "output-validation-failed"
248- ) ;
249- }
250245 implContent . push ( `#include "${ includePathPrefix } generated/${ baseName } .h" // ${ hash } ` ) ;
251246 }
252247
@@ -325,7 +320,14 @@ std::string pass_as_string(T&& v) {
325320 templateImplementationHash . set ( name , createHash ( "sha256" ) . update ( content ) . digest ( "hex" ) ) ;
326321 }
327322
328- // STEP.2. Generate implementation index_impl.h
323+ // STEP.2. Generate the string table if needed
324+ if ( this . #stringTable) {
325+ const content = this . #buildGenerateStringTable( ) ;
326+ result . set ( "string_table.h" , content ) ;
327+ templateImplementationHash . set ( "string_table.h" , createHash ( "sha256" ) . update ( content ) . digest ( "hex" ) ) ;
328+ }
329+
330+ // STEP.3. Generate implementation index_impl.h
329331 result . set (
330332 "index_impl.h" ,
331333 this . #buildGenerateIndexImpl(
@@ -336,14 +338,9 @@ std::string pass_as_string(T&& v) {
336338 )
337339 ) ;
338340
339- // STEP.3 . Generate the index.h
341+ // STEP.4 . Generate the index.h
340342 result . set ( "index.h" , this . #buildGenerateIndex( repo ) ) ;
341343
342- // STEP.4. Generate the string table if needed
343- if ( this . #stringTable) {
344- result . set ( "string_table.h" , this . #buildGenerateStringTable( ) ) ;
345- }
346-
347344 return {
348345 basePath : repo . basePath ,
349346 templates : result ,
0 commit comments