mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 21:42:59 -05:00
Script checker: open on a File held in a variable named app writes
`var app = new File(p); app.open('w');` was reported as an application
open (file.read). A receiver that holds a File now takes the File open
mode rules, so the check reports file.write and filesWritten.
This commit is contained in:
1 parent
b4505b2558
commit
56dd6d07e5
2 files changed
+2
-1
No files matched your search
@@ -355,7 +355,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
|
||||
let file = held.is_some();
|
||||
if n == catalog::MENU_COMMAND {
|
||||
self.pending = Pending::Menu(line);
|
||||
} else if n == catalog::OPEN && word(h2, "app") && !member_mark(h3) && !self.shadowed[0] {
|
||||
} else if n == catalog::OPEN && word(h2, "app") && !member_mark(h3) && !self.shadowed[0] && !file {
|
||||
self.acc.feature(FeatureId::FileRead, line);
|
||||
} else if n == catalog::OPEN && file {
|
||||
self.pending = Pending::Open(line);
|
||||
|
||||
@@ -63,6 +63,7 @@ const FEATURE_CASES: &[(&str, &str, &str)] = &[
|
||||
("file.read", "var all = folder.getFiles();", "var all = folder.files;"),
|
||||
("file.read", "var s = File(p).read();", "var s = Cache(p).read();"),
|
||||
("file.write", "var f = new File(p); f.open('w');", "var f = new File(p); f.open('r');"),
|
||||
("file.write", "var app = new File(p); app.open('w');", "var app = new File(p); app.open('r');"),
|
||||
("file.write", "var f = File.saveDialog(); f.write(s);", "var f = picker(); f.write(s);"),
|
||||
("file.write", "new File(p).remove();", "new Thing(p).remove();"),
|
||||
("file.write", "var a = new File(p); var b = a; b.remove();", "var a = new File(p); var b = a.parent; b.remove();"),
|
||||
|
||||
Reference in new issue
Block a user