mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 20:43:18 -05:00
Merge main into feat/scripts-api-d8b-tracing
This commit is contained in:
commit
226eb80e6f
1182 files changed
+178402
-264198
No files matched your search
@@ -249,9 +249,11 @@ enum Pending<'s> {
|
||||
/// `Window`: `(` and a string literal with the window's type may follow.
|
||||
Window(Option<usize>),
|
||||
WindowType(Option<usize>),
|
||||
/// `.executeMenuCommand(`: a string literal and `)` may follow.
|
||||
/// `.executeMenuCommand(`: a string literal and `)` may follow, with a trailing comma
|
||||
/// between them.
|
||||
Menu(Option<usize>),
|
||||
MenuString(Option<usize>, &'s str),
|
||||
MenuStringComma(Option<usize>, &'s str),
|
||||
/// `.open(`: a string literal with the open mode may follow.
|
||||
Open(Option<usize>),
|
||||
/// A File object's `length`, `hidden` or `readonly` (`f.length`, `f['length']`): an assignment
|
||||
|
||||
@@ -66,7 +66,8 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
|
||||
self.menu(None, l);
|
||||
}
|
||||
}
|
||||
Pending::MenuString(l, s) => self.menu(t.is(")").then_some(s), l),
|
||||
Pending::MenuString(l, s) if t.is(",") => self.pending = Pending::MenuStringComma(l, s),
|
||||
Pending::MenuString(l, s) | Pending::MenuStringComma(l, s) => self.menu(t.is(")").then_some(s), l),
|
||||
Pending::Open(l) => {
|
||||
if t.kind == T::Str {
|
||||
self.open_mode(&unquote(t.text, 2), l);
|
||||
@@ -123,7 +124,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
|
||||
}
|
||||
match pending {
|
||||
Pending::Window(l) | Pending::WindowType(l) => self.acc.feature(FeatureId::ScriptuiWindow, l),
|
||||
Pending::Menu(l) | Pending::MenuString(l, _) => self.menu(None, l),
|
||||
Pending::Menu(l) | Pending::MenuString(l, _) | Pending::MenuStringComma(l, _) => self.menu(None, l),
|
||||
Pending::Setter(l, true) => self.file_setter(l),
|
||||
Pending::Open(_) | Pending::Setter(_, false) | Pending::Name(..) | Pending::None => {}
|
||||
}
|
||||
|
||||
@@ -1584,6 +1584,18 @@ fn menu_commands_are_counted_with_their_lines() {
|
||||
assert_eq!(feature(&r, "menuCommand").map(|f| f.count), Some(6));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_menu_command_string_with_a_trailing_comma_is_listed() {
|
||||
let r = report(concat!(
|
||||
"app.executeMenuCommand('acmecopyall',);\n",
|
||||
"app.executeMenuCommand('acmecopyall', n);\n",
|
||||
"app.executeMenuCommand('acmecopyall',\n",
|
||||
));
|
||||
let strings: Vec<(&str, usize, &[usize])> = r.menu_strings.iter().map(|s| (s.value.as_str(), s.count, s.lines.as_slice())).collect();
|
||||
assert_eq!(strings, [("acmecopyall", 1, &[1][..])]);
|
||||
assert_eq!(r.menu_dynamic, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effects_outside_the_document_are_listed_in_order() {
|
||||
let r = report(concat!(
|
||||
|
||||
Reference in new issue
Block a user