typegen: fix function and signal parameters being sorted by name
This commit is contained in:
parent
c1c349caaa
commit
a036d378c0
|
@ -1,6 +1,6 @@
|
|||
{{- $first := true -}}
|
||||
{{- range $param, $type := . -}}
|
||||
{{- range $param := . -}}
|
||||
{{- if ne $first true -}}, {{ end -}}
|
||||
{{- $first = false -}}
|
||||
{{ $param }}: {{ partial "qmltype.html" $type }}
|
||||
{{ $param.name }}: {{ partial "qmltype.html" $param.type }}
|
||||
{{- end -}}
|
|
@ -52,14 +52,21 @@ pub struct Function {
|
|||
pub name: String,
|
||||
pub id: String,
|
||||
pub details: Option<String>,
|
||||
pub params: HashMap<String, Type>,
|
||||
pub params: Vec<Parameter>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Signal {
|
||||
pub name: String,
|
||||
pub details: Option<String>,
|
||||
pub params: HashMap<String, Type>,
|
||||
pub params: Vec<Parameter>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Parameter {
|
||||
pub name: String,
|
||||
#[serde(rename = "type")]
|
||||
pub type_: Type,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
outform::{self, Flag, PropertyType},
|
||||
outform::{self, Flag, Parameter, PropertyType},
|
||||
typespec::{FnParam, Function, Property, Signal, TypeSpec},
|
||||
};
|
||||
|
||||
|
@ -147,7 +147,8 @@ pub fn resolve_types(
|
|||
ret: qmlparamtype(&func.ret, typespec),
|
||||
name: func.name.clone(),
|
||||
id: {
|
||||
let params = func.params
|
||||
let params = func
|
||||
.params
|
||||
.iter()
|
||||
.map(|FnParam { type_, .. }| qmlparamtype(type_, typespec).name);
|
||||
|
||||
|
@ -166,7 +167,10 @@ pub fn resolve_types(
|
|||
params: func
|
||||
.params
|
||||
.iter()
|
||||
.map(|FnParam { type_, name }| (name.clone(), qmlparamtype(type_, typespec)))
|
||||
.map(|FnParam { type_, name }| Parameter {
|
||||
name: name.clone(),
|
||||
type_: qmlparamtype(type_, typespec),
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +182,10 @@ pub fn resolve_types(
|
|||
params: func
|
||||
.params
|
||||
.iter()
|
||||
.map(|FnParam { type_, name }| (name.clone(), qmlparamtype(type_, typespec)))
|
||||
.map(|FnParam { type_, name }| Parameter {
|
||||
name: name.clone(),
|
||||
type_: qmlparamtype(type_, typespec),
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue