Skip to content

Commit b89a5b0

Browse files
committed
v0.8.22
1 parent 993fc2f commit b89a5b0

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,4 @@ keywords = ["stof", "language", "embedded", "interpreter", "document"]
120120
license = "Apache-2.0"
121121
name = "stof"
122122
repository = "https://github.com/dev-formata-io/stof"
123-
version = "0.8.21"
123+
version = "0.8.22"

project.stof

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ github: {
205205
/// Generate Cargo.toml file.
206206
/// `stof run project.stof -a cargo`
207207
async fn generate_cargo_toml() {
208-
const out = await Rust.Cargo.generate(self.cargo, 0.8.21, update = false);
208+
const out = await Rust.Cargo.generate(self.cargo, 0.8.22, update = false);
209209
fs.write('Cargo.toml', out);
210210
pln('Cargo .. ok');
211211
}

src/model/formats/stof/tests/lang/fields/mod.stof

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,16 @@ ParseFieldBeforeComment: {
136136
*/
137137
fn another_func() {}
138138
}
139+
140+
141+
#[type]
142+
AbsolutePathModify: {
143+
field: []
144+
145+
#[test]
146+
fn push_list_back() {
147+
root.Lang.Fields.AbsolutePathModify.field.push_back('hello');
148+
<Fields.AbsolutePathModify>.field.push_back('bob');
149+
assert_eq(self.field, ['hello', 'bob']);
150+
}
151+
}

src/runtime/instructions/call.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,27 @@ impl FuncCall {
134134
if let Ok(res) = self.object_search(path, None, env, graph, false) {
135135
return Ok(res);
136136
}
137-
// Only a valid libcall if the length is 2
137+
138+
// Only a valid libcall if the length is 2 and a library function exists
138139
if split_path.len() == 2 {
139-
return Ok(CallContext { lib: Some(split_path[0].to_string().into()), stack_arg: None, prototype_self: None, func: SId::from(split_path[1]) });
140+
let libname = ArcStr::from(split_path[0]);
141+
if graph.libfunc(&libname, split_path[1]).is_some() {
142+
return Ok(CallContext { lib: Some(libname), stack_arg: None, prototype_self: None, func: SId::from(split_path[1]) });
143+
}
144+
}
145+
146+
// Now we are looking for a path + implied library function
147+
if split_path.len() > 1 {
148+
let func_name = split_path.pop().unwrap();
149+
let path = split_path.join(".");
150+
151+
// using Base.LoadVariable as a meta instruction for accuracy
152+
// var will be loaded onto the env.stack!
153+
Base::LoadVariable(path.into(), false, false).exec(env, graph)?;
154+
let var = env.stack.pop().unwrap(); // yup, cool
155+
156+
let libname = var.lib_name(&graph);
157+
return Ok(CallContext { lib: Some(libname), stack_arg: Some(Arc::new(Base::Variable(var))), prototype_self: None, func: SId::from(func_name) });
140158
}
141159
return Err(Error::FuncDne);
142160
}

0 commit comments

Comments
 (0)