Skip to content

Commit

Permalink
Added more to ftd.json test and is working
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Jan 31, 2025
1 parent e3b304e commit 4934043
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
9 changes: 3 additions & 6 deletions ftd/src/interpreter/things/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,9 @@ impl PropertyExt for fastn_resolved::Property {
// not assume this is kw-args one.
match get_kw_args_name(&component_arguments, &v) {
None => properties.push(v),
Some(name) => match v.value {
t @ fastn_resolved::PropertyValue::Reference { .. } => {
kw_args_properties.insert(name.clone(), t);
}
_ => todo!(),
},
Some(name) => {
kw_args_properties.insert(name.clone(), v.value);
}
}
}

Expand Down
23 changes: 23 additions & 0 deletions ftd/src/interpreter/things/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,29 @@ impl PropertyValueExt for fastn_resolved::PropertyValue {
line_number: value.line_number(),
},
),
fastn_resolved::Kind::KwArgs => {
let line_number = value.line_number();
let value_str = value.string(doc.name)?;
let value = if let Ok(value) = value_str.parse::<f64>() {
fastn_resolved::Value::Decimal { value }
} else if let Ok(value) = value_str.parse::<i64>() {
fastn_resolved::Value::Integer { value }
} else if let Ok(value) = value_str.parse::<bool>() {
fastn_resolved::Value::Boolean { value }
} else {
fastn_resolved::Value::String {
text: value_str.to_string(),
}
};

ftd::interpreter::StateWithThing::new_thing(
fastn_resolved::PropertyValue::Value {
value,
is_mutable,
line_number,
},
)
}
t => {
unimplemented!("t::{:?} {:?}", t, value)
}
Expand Down
2 changes: 1 addition & 1 deletion ftd/t/js/99-ftd-json.ftd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- integer x: 20

-- ftd.json:
;; name: Bob
name: Bob
age: $x
2 changes: 1 addition & 1 deletion ftd/t/js/99-ftd-json.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4934043

Please sign in to comment.