@@ -461,7 +461,7 @@ func (g *Generator) generateValue(value any) string {
461
461
case * lang.MultiFn :
462
462
return g .generateMultiFn (v )
463
463
case lang.Keyword :
464
- if ns := v .Namespace (); ns != "" {
464
+ if ns := v .Namespace (); ns != nil {
465
465
return g .allocKWVar (fmt .Sprintf ("%s/%s" , ns , v .Name ()))
466
466
} else {
467
467
return g .allocKWVar (v .Name ())
@@ -1213,11 +1213,11 @@ func (g *Generator) generateCase(node *ast.Node) string {
1213
1213
// if a test matches, we evaluate the corresponding body and assign to resultVar
1214
1214
// Generate code based on test type
1215
1215
testType := caseNode .TestType .(lang.Keyword )
1216
-
1216
+
1217
1217
// Calculate the lookup key based on test type
1218
1218
lookupVar := g .allocateTempVar ()
1219
1219
g .writef ("var %s int64\n " , lookupVar )
1220
-
1220
+
1221
1221
switch testType {
1222
1222
case lang .KWInt :
1223
1223
// For integers, convert directly to int64 and apply shift/mask
@@ -1234,7 +1234,7 @@ func (g *Generator) generateCase(node *ast.Node) string {
1234
1234
g .writef ("%s = int64(uint32(%s >> %d) & uint32(%d))\n " ,
1235
1235
lookupVar , lookupVar , caseNode .Shift , caseNode .Mask )
1236
1236
}
1237
-
1237
+
1238
1238
case lang .KWHashIdentity :
1239
1239
// Use identity hash
1240
1240
if caseNode .Mask == 0 {
@@ -1243,7 +1243,7 @@ func (g *Generator) generateCase(node *ast.Node) string {
1243
1243
g .writef ("%s = int64(uint32(lang.IdentityHash(%s) >> %d) & uint32(%d))\n " ,
1244
1244
lookupVar , testExpr , caseNode .Shift , caseNode .Mask )
1245
1245
}
1246
-
1246
+
1247
1247
case lang .KWHashEquiv :
1248
1248
// Use hash
1249
1249
if caseNode .Mask == 0 {
@@ -1253,19 +1253,19 @@ func (g *Generator) generateCase(node *ast.Node) string {
1253
1253
lookupVar , testExpr , caseNode .Shift , caseNode .Mask )
1254
1254
}
1255
1255
}
1256
-
1256
+
1257
1257
// Generate switch statement for the entries
1258
1258
first := true
1259
1259
for i , entry := range caseNode .Entries {
1260
1260
g .writef ("// case entry %d (key=%d, collision=%v)\n " , i , entry .Key , entry .HasCollision )
1261
-
1261
+
1262
1262
if first {
1263
1263
g .writef ("if %s == %d {\n " , lookupVar , entry .Key )
1264
1264
first = false
1265
1265
} else {
1266
1266
g .writef ("} else if %s == %d {\n " , lookupVar , entry .Key )
1267
1267
}
1268
-
1268
+
1269
1269
if entry .HasCollision {
1270
1270
// For collision cases, evaluate the condp expression
1271
1271
condpExpr := g .generateASTNode (entry .ResultExpr )
0 commit comments