compiler: implement clear builtin for maps

This commit is contained in:
Ayke van Laethem
2023-07-07 15:47:49 +02:00
committed by Ron Evans
parent a2f886a67a
commit f1e25a18d2
7 changed files with 64 additions and 0 deletions
+5
View File
@@ -185,6 +185,11 @@ func (b *builder) createMapDelete(keyType types.Type, m, key llvm.Value, pos tok
}
}
// Clear the given map.
func (b *builder) createMapClear(m llvm.Value) {
b.createRuntimeCall("hashmapClear", []llvm.Value{m}, "")
}
// createMapIteratorNext lowers the *ssa.Next instruction for iterating over a
// map. It returns a tuple of {bool, key, value} with the result of the
// iteration.