Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added file.append #1295

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions kclvm/api/src/service/service_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ impl KclvmServiceImpl {
/// assert_eq!(result.type_errors.len(), 0);
/// assert_eq!(result.symbols.len(), 12);
/// assert_eq!(result.scopes.len(), 3);
/// assert_eq!(result.node_symbol_map.len(), 175);
/// assert_eq!(result.symbol_node_map.len(), 175);
/// assert_eq!(result.fully_qualified_name_map.len(), 184);
/// assert_eq!(result.node_symbol_map.len(), 176);
/// assert_eq!(result.symbol_node_map.len(), 176);
/// assert_eq!(result.fully_qualified_name_map.len(), 185);
/// assert_eq!(result.pkg_scope_map.len(), 3);
/// ```
#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -291,6 +284,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down
48 changes: 24 additions & 24 deletions kclvm/loader/src/snapshots/kclvm_loader__tests__builtin_call_1.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down Expand Up @@ -180,13 +180,6 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -383,6 +376,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -415,20 +415,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 164,
index: 165,
generation: 0,
},
kind: Value,
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -625,6 +618,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -664,13 +664,6 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -867,6 +860,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -899,7 +899,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 165,
index: 166,
generation: 0,
},
kind: Value,
Expand Down
52 changes: 26 additions & 26 deletions kclvm/loader/src/snapshots/kclvm_loader__tests__builtin_call_2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down Expand Up @@ -240,7 +240,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 164,
index: 165,
generation: 0,
},
kind: Value,
Expand Down Expand Up @@ -337,7 +337,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down Expand Up @@ -382,13 +382,6 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -585,6 +578,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -617,20 +617,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 165,
index: 166,
generation: 0,
},
kind: Value,
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -827,6 +820,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -866,13 +866,6 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
),
attrs: [
SymbolRef {
id: Index {
index: 134,
generation: 0,
},
kind: Value,
},
SymbolRef {
id: Index {
index: 135,
Expand Down Expand Up @@ -1069,6 +1062,13 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
},
kind: Value,
},
SymbolRef {
id: Index {
index: 163,
generation: 0,
},
kind: Value,
},
],
is_global: false,
},
Expand Down Expand Up @@ -1101,7 +1101,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 166,
index: 167,
generation: 0,
},
kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
def: Some(
SymbolRef {
id: Index {
index: 163,
index: 164,
generation: 0,
},
kind: Value,
Expand Down
2 changes: 2 additions & 0 deletions kclvm/runtime/src/_kclvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ kclvm_value_ref_t* kclvm_dict_values(kclvm_context_t* ctx, kclvm_value_ref_t* p)

kclvm_value_ref_t* kclvm_file_abs(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);

kclvm_value_ref_t* kclvm_file_append(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);

kclvm_value_ref_t* kclvm_file_cp(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);

kclvm_value_ref_t* kclvm_file_delete(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);
Expand Down
2 changes: 2 additions & 0 deletions kclvm/runtime/src/_kclvm.ll
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ declare %kclvm_value_ref_t* @kclvm_dict_values(%kclvm_context_t* %ctx, %kclvm_va

declare %kclvm_value_ref_t* @kclvm_file_abs(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);

declare %kclvm_value_ref_t* @kclvm_file_append(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);

declare %kclvm_value_ref_t* @kclvm_file_cp(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);

declare %kclvm_value_ref_t* @kclvm_file_delete(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);
Expand Down
1 change: 1 addition & 0 deletions kclvm/runtime/src/_kclvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub enum ApiFunc {
kclvm_dict_update_key_value,
kclvm_dict_values,
kclvm_file_abs,
kclvm_file_append,
kclvm_file_cp,
kclvm_file_delete,
kclvm_file_exists,
Expand Down
1 change: 1 addition & 0 deletions kclvm/runtime/src/_kclvm_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ pub fn _kclvm_get_fn_ptr_by_name(name: &str) -> u64 {
"kclvm_dict_update_key_value" => crate::kclvm_dict_update_key_value as *const () as u64,
"kclvm_dict_values" => crate::kclvm_dict_values as *const () as u64,
"kclvm_file_abs" => crate::kclvm_file_abs as *const () as u64,
"kclvm_file_append" => crate::kclvm_file_append as *const () as u64,
"kclvm_file_cp" => crate::kclvm_file_cp as *const () as u64,
"kclvm_file_delete" => crate::kclvm_file_delete as *const () as u64,
"kclvm_file_exists" => crate::kclvm_file_exists as *const () as u64,
Expand Down
4 changes: 4 additions & 0 deletions kclvm/runtime/src/_kclvm_api_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,10 @@
// api-spec(c): kclvm_value_ref_t* kclvm_file_abs(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);
// api-spec(llvm): declare %kclvm_value_ref_t* @kclvm_file_abs(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);

// api-spec: kclvm_file_append
// api-spec(c): kclvm_value_ref_t* kclvm_file_append(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);
// api-spec(llvm): declare %kclvm_value_ref_t* @kclvm_file_append(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);

// api-spec: kclvm_file_mkdir
// api-spec(c): kclvm_value_ref_t* kclvm_file_mkdir(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);
// api-spec(llvm): declare %kclvm_value_ref_t* @kclvm_file_mkdir(%kclvm_context_t* %ctx, %kclvm_value_ref_t* %args, %kclvm_value_ref_t* %kwargs);
Expand Down
Loading
Loading