Fix parsing of braced expressions followed by a method (#4035)
* Fix parsing of braced expressions followed by a method * Improves the logic for parsing braced expressions * Fix hot-reload issue * Added cases for braced expressions followed by identifiers or string literals
This commit is contained in:
1 parent
f43a8c69fa
commit
71d85e6dd5
2 files changed
+53
-3
No files matched your search
@@ -71,6 +71,7 @@ fn complex_kitchen_sink() {
|
||||
// complex_carry
|
||||
button {
|
||||
class: "flex items-center pl-3 py-3 pr-2 text-gray-500 hover:bg-indigo-50 rounded",
|
||||
width: {"100%"}.to_string(),
|
||||
onclick: move |evt| {
|
||||
show_user_menu.set(!show_user_menu.get());
|
||||
evt.cancel_bubble();
|
||||
@@ -167,3 +168,27 @@ fn key_cannot_be_static() {
|
||||
println!("{:?}", parsed.body.diagnostics);
|
||||
assert!(!parsed.body.diagnostics.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn braced_expressions() {
|
||||
let item = quote::quote! {
|
||||
div {
|
||||
width: {100} - 50,
|
||||
width: {"100%"}.to_string(),
|
||||
width: {|| "100%"}(),
|
||||
}
|
||||
// Partial expressions in braces rsx should be allowed and output as-is
|
||||
// for autocomplete
|
||||
{partial.}
|
||||
div {}
|
||||
{partial.}
|
||||
// Comments should be ignored
|
||||
div {}
|
||||
{partial.}
|
||||
"hello world"
|
||||
{partial.}
|
||||
if true {}
|
||||
};
|
||||
|
||||
let _cb: CallBody = syn::parse2(item).unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user