mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: v -autofree can now compile itself
This commit is contained in:
@@ -98,11 +98,17 @@ pub fn (a array) reverse() array {
|
||||
return a
|
||||
}
|
||||
|
||||
// array.clone_static returns an independent copy of a given array
|
||||
// It should be used only in -autofree generated code.
|
||||
fn (a array) clone_static() array {
|
||||
return a.clone()
|
||||
}
|
||||
|
||||
pub fn (a array) clone() array {
|
||||
return a
|
||||
}
|
||||
|
||||
pub fn (a array) free() {
|
||||
pub fn (a &array) free() {
|
||||
}
|
||||
|
||||
// "[ 'a', 'b', 'c' ]"
|
||||
|
@@ -26,6 +26,11 @@ pub fn tos(s byteptr) string {
|
||||
}
|
||||
}
|
||||
|
||||
// string.clone_static returns an independent copy of a given array
|
||||
// It should be used only in -autofree generated code.
|
||||
fn (a string) clone_static() string {
|
||||
return a.clone()
|
||||
}
|
||||
|
||||
pub fn (a string) clone() string {
|
||||
return a
|
||||
@@ -241,18 +246,9 @@ pub fn (c byte) is_letter() bool {
|
||||
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`)
|
||||
}
|
||||
|
||||
pub fn (s string) free() {
|
||||
pub fn (s &string) free() {
|
||||
}
|
||||
|
||||
/*
|
||||
fn (arr []string) free() {
|
||||
for s in arr {
|
||||
s.free()
|
||||
}
|
||||
C.free(arr.data)
|
||||
}
|
||||
*/
|
||||
|
||||
// all_before('23:34:45.234', '.') == '23:34:45'
|
||||
pub fn (s string) all_before(dot string) string {
|
||||
pos := s.index(dot)
|
||||
|
Reference in New Issue
Block a user