Change Type::Object to be able to hold a name

Internally, structure will be represented with a Type::Object with a name
instead of a Component with a void base type
This commit is contained in:
Olivier Goffart 2020-10-27 15:03:31 +01:00
parent b9533a217e
commit 333c96fd79
9 changed files with 176 additions and 66 deletions

View file

@ -182,10 +182,10 @@ fn to_eval_value<'cx>(
},
Type::Resource => Ok(Value::String(val.to_string(cx)?.value().into())),
Type::Bool => Ok(Value::Bool(val.downcast_or_throw::<JsBoolean, _>(cx)?.value())),
Type::Object(o) => {
Type::Object{fields, ..} => {
let obj = val.downcast_or_throw::<JsObject, _>(cx)?;
Ok(Value::Object(
o
fields
.iter()
.map(|(pro_name, pro_ty)| {
Ok((