aboutsummaryrefslogtreecommitdiff
path: root/src/common/ast.odin
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-03-14 21:41:04 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-03-14 21:41:04 +0100
commit123783da820cfa5cd2b230dd910e07005f30ebca (patch)
tree487c2d24647bec8f48328f9bb9eeb9ca4149af2c /src/common/ast.odin
parent06562b8ff7d3d4ad3bb22b66eef8c8111fe243da (diff)
Fix union completion with pointers.
Diffstat (limited to 'src/common/ast.odin')
-rw-r--r--src/common/ast.odin13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin
index 05c651f..34cbd4b 100644
--- a/src/common/ast.odin
+++ b/src/common/ast.odin
@@ -495,7 +495,6 @@ free_ast_node :: proc(node: ^ast.Node, allocator: mem.Allocator) {
}
free_ast_file :: proc(file: ast.File, allocator := context.allocator) {
-
for decl in file.decls {
free_ast(decl, allocator)
}
@@ -518,7 +517,6 @@ node_equal :: proc{
}
node_equal_array :: proc(a, b: $A/[]^$T) -> bool {
-
ret := true
if len(a) != len(b) {
@@ -533,7 +531,6 @@ node_equal_array :: proc(a, b: $A/[]^$T) -> bool {
}
node_equal_dynamic_array :: proc(a, b: $A/[dynamic]^$T) -> bool {
-
ret := true
if len(a) != len(b) {
@@ -707,7 +704,6 @@ node_equal_node :: proc(a, b: ^ast.Node) -> bool {
Returns the string representation of a type. This allows us to print the signature without storing it in the indexer as a string(saving memory).
*/
node_to_string :: proc(node: ^ast.Node) -> string {
-
builder := strings.make_builder(context.temp_allocator)
build_string(node, &builder)
@@ -722,14 +718,12 @@ build_string :: proc{
}
build_string_dynamic_array :: proc(array: $A/[]^$T, builder: ^strings.Builder) {
-
for elem, i in array {
build_string(elem, builder)
}
}
build_string_ast_array :: proc(array: $A/[dynamic]^$T, builder: ^strings.Builder) {
-
for elem, i in array {
build_string(elem, builder)
}
@@ -908,3 +902,10 @@ build_string_node :: proc(node: ^ast.Node, builder: ^strings.Builder) {
build_string(n.value, builder)
}
}
+
+repeat :: proc(value: string, count: int, allocator := context.allocator) -> string {
+ if count == 0 {
+ return ""
+ }
+ return strings.repeat(value, count, allocator)
+}