define slider function
This commit is contained in:
parent
8d6f8086f5
commit
0488f85b9e
35
src/main.rs
35
src/main.rs
|
@ -324,6 +324,41 @@ fn compile(code: &String, run_symbol: &String, output_filename: &Path) -> Result
|
|||
}
|
||||
}
|
||||
|
||||
let ty = composer
|
||||
.unifier
|
||||
.add_ty(typedef::TypeEnum::TFunc(typedef::FunSignature {
|
||||
args: vec![typedef::FuncArg {
|
||||
name: "value".into(),
|
||||
ty: primitive.float,
|
||||
default_value: None,
|
||||
is_vararg: false,
|
||||
}],
|
||||
ret: primitive.float,
|
||||
vars: typedef::VarMap::new(),
|
||||
}));
|
||||
let name_ref = "slider".into();
|
||||
let mut function_def = composer::TopLevelComposer::make_top_level_function_def(
|
||||
"slider".to_string(),
|
||||
name_ref,
|
||||
ty,
|
||||
Some(resolver.clone()),
|
||||
None,
|
||||
);
|
||||
if let toplevel::TopLevelDef::Function { ref mut instance_to_symbol, .. } = function_def {
|
||||
instance_to_symbol.insert("".to_string(), "__nac3_cells_slider".to_string());
|
||||
} else {
|
||||
unreachable!();
|
||||
};
|
||||
composer.definition_ast_list.push((
|
||||
RwLock::new(function_def).into(),
|
||||
None,
|
||||
));
|
||||
internal_resolver.add_id_def(
|
||||
name_ref,
|
||||
toplevel::DefinitionId(composer.definition_ast_list.len() - 1),
|
||||
);
|
||||
internal_resolver.add_id_type(name_ref, ty);
|
||||
|
||||
let signature = typedef::FunSignature {
|
||||
args: vec![],
|
||||
ret: primitive.none,
|
||||
|
|
Loading…
Reference in New Issue