Skip to content

Commit be9d2b0

Browse files
committed
fixes
1 parent 5156c6d commit be9d2b0

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

vlib/v/gen/wasm/gen.v

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ pub fn (mut g Gen) infix_expr(node ast.InfixExpr, expected ast.Type) {
426426
// Call the builtin__array_eq() function
427427
g.expr(node.left, node.left_type)
428428
g.expr(node.right, node.right_type)
429-
g.func.call('builtin__array_eq')
430-
429+
g.func.call('array_eq')
430+
431431
// If it's !=, negate the result
432432
if node.op == .ne {
433433
g.func.eqz(.i32_t)
@@ -771,41 +771,41 @@ pub fn (mut g Gen) expr(node ast.Expr, expected ast.Type) {
771771
// Array slicing: arr[start..end]
772772
// Call the array.slice() method
773773
result_var := g.new_local('__slice_result', expected)
774-
774+
775775
// Get the array we're slicing
776776
g.get(result_var)
777777
g.expr(node.left, node.left_type)
778-
778+
779779
// Get start index (or 0 if missing)
780780
if node.index.has_low {
781781
g.expr(node.index.low, ast.int_type)
782782
} else {
783783
g.literalint(0, ast.int_type)
784784
}
785-
785+
786786
// Get end index (or max_i32 if missing)
787787
if node.index.has_high {
788788
g.expr(node.index.high, ast.int_type)
789789
} else {
790790
// Use max_i32 to indicate "end of array"
791791
g.literalint(2147483647, ast.int_type) // max_i32
792792
}
793-
793+
794794
// Call slice() method
795795
// The method returns a new array struct
796-
g.func.call('builtin__array_slice')
797-
796+
g.func.call('array_slice')
797+
798798
// Store the result
799799
arr_struct_size, _ := g.pool.type_size(expected)
800800
g.func.i32_const(i32(arr_struct_size))
801801
g.func.call('vmemcpy')
802802
g.func.drop()
803-
803+
804804
// Return the result
805805
g.get(result_var)
806806
return
807807
}
808-
808+
809809
// Regular array indexing
810810
mut direct_array_access := g.is_direct_array_access || node.is_direct
811811
mut tmp_voidptr_var := wasm.LocalIndex(-1)

vlib/v/gen/wasm/mem.v

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,14 +1095,14 @@ pub fn (mut g Gen) set_with_expr(init ast.Expr, v Var) {
10951095
if init.has_len || init.has_cap || init.has_init {
10961096
// Array init with named params: []int{len: 5, cap: 10, init: 42}
10971097
// Use __new_array_with_default(len, cap, elm_size, default_value_ptr)
1098-
1098+
10991099
// Push len (required or 0)
11001100
if init.has_len {
11011101
g.expr(init.len_expr, ast.int_type)
11021102
} else {
11031103
g.literalint(0, ast.int_type)
11041104
}
1105-
1105+
11061106
// Push cap (or use len if not specified)
11071107
if init.has_cap {
11081108
g.expr(init.cap_expr, ast.int_type)
@@ -1111,28 +1111,28 @@ pub fn (mut g Gen) set_with_expr(init ast.Expr, v Var) {
11111111
} else {
11121112
g.literalint(0, ast.int_type)
11131113
}
1114-
1114+
11151115
// Push element_size
11161116
g.literalint(elm_size, ast.int_type)
1117-
1117+
11181118
// Push init value pointer (or 0 for no default)
11191119
if init.has_init {
11201120
// Allocate space on stack for init value
11211121
mut init_var := g.new_local('__init', elm_typ)
11221122
init_var_addr := g.ensure_var_addressable(mut init_var)
1123-
1123+
11241124
// Store init value
11251125
g.get(init_var_addr)
11261126
g.expr(init.init_expr, elm_typ)
11271127
g.store(elm_typ, 0)
1128-
1128+
11291129
// Push address of init value
11301130
g.get(init_var_addr)
11311131
} else {
11321132
g.literalint(0, ast.int_type)
11331133
}
1134-
1135-
g.func.call('builtin____new_array_with_default')
1134+
1135+
g.func.call('__new_array_with_default')
11361136
} else {
11371137
// Regular array initialization: [1, 2, 3]
11381138
// Calculate array length
@@ -1142,7 +1142,7 @@ pub fn (mut g Gen) set_with_expr(init ast.Expr, v Var) {
11421142
g.literalint(arr_len, ast.int_type) // len
11431143
g.literalint(arr_len, ast.int_type) // cap (same as len for now)
11441144
g.literalint(elm_size, ast.int_type) // element_size
1145-
g.func.call('builtin____new_array')
1145+
g.func.call('__new_array')
11461146
}
11471147

11481148
// Store the returned array struct

vlib/v/gen/wasm/tests/wasm_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn test_wasm() {
6565

6666
// Test with -b wasm
6767
bench.step()
68-
cmd_wasm := '${os.quoted_path(vexe)} -b wasm run ${os.quoted_path(full_test_path)} 2> ${os.quoted_path(tmperrfile)}'
68+
cmd_wasm := '${os.quoted_path(vexe)} -b wasm -v run ${os.quoted_path(full_test_path)} 2> ${os.quoted_path(tmperrfile)}'
6969
if is_verbose {
7070
println(cmd_wasm)
7171
}

0 commit comments

Comments
 (0)