Editorial: Don't use dot access in most places#90
Conversation
|
I believe none of the other instances of dot access are for "concepts" but please correct me if I'm wrong |
|
So accessing dictionary members through dots is also wrong. Dictionaries are to be treated as maps. I think the only correct dot usage is in serialization and deserialization. |
7aa5fda to
c541310
Compare
|
Rebased this on the infra changes introduced in #95 (and updated to remove use of dot access in most places, as you suggest in your last comment). PTAL? |
| 1. Let |command| be |input|.{{WriteParams/type}} if |input| is a {{WriteParams}}, | ||
| and {{WriteCommandType/"write"}} otherwise. | ||
| 1. Let |command| be |input|'s {{WriteParams/type}} if | ||
| |input| is a {{WriteParams}}; otherwise {{WriteCommandType/"write"}}. |
There was a problem hiding this comment.
is a [=/dictionary=]*
We don't know the dictionary type at this point. Existing issue though so feel free to file a follow-up. (Or I could.)
There was a problem hiding this comment.
Sounds like we can't check the specific type (i.e. WriteParams) of a union? Just the data structure (i.e. dictionary/boolean/etc)
Would you mind filing a follow-up?
| 1. If |input| is `undefined` or |input| is a [=/dictionary=] and | ||
| |input|["{{WriteParams/data}}"] does not [=map/exists|exist=], | ||
| [=/reject=] |p| with a {{TypeError}} and abort these steps. | ||
| 1. Let |writePosition| be |stream|.[=[[seekOffset]]=]. | ||
| 1. If |input| is a {{WriteParams}} and |input|.{{WriteParams/position}} is not `undefined`, | ||
| set |writePosition| to |input|.{{WriteParams/position}}. | ||
| 1. Let |oldSize| be |stream|.[=[[buffer]]=]'s [=byte sequence/length=]. | ||
| 1. Let |data| be |input|["{{WriteParams/data}}"] if | ||
| |input| is a [=/dictionary=]; otherwise |input|. |
There was a problem hiding this comment.
FYI: this is a no-op, but which allows us to check [=map/exists=] rather than rely on the dictionary access returning undefined
This reveals a separate issue that |input| comes from "converting to an IDL value" algorithm, which appears to be able to return both null and undefined? Is that a problem?
I've left it as-is for now so that this CL can remain "Editorial" but happy to address this in a follow-up if it's a problem
| 1. [=/Resolve=] |p|. | ||
| 1. Otherwise, if |command| is {{WriteCommandType/"seek"}}: | ||
| 1. If |chunk|.{{WriteParams/position}} is `undefined`, | ||
| 1. [=Assert=]: |chunk| is a [=/dictionary=]. |
There was a problem hiding this comment.
not sure whether this counts as a non-editorial change... the previous text assumes this to be true
There was a problem hiding this comment.
Removing one might not be, but adding one seems fine.
|
Feel free to merge if this looks good. Thanks! |
Follow-up to whatwg/fs#90 Also fixes a use of FileSystemPermissionDescriptor in the showDirectoryPicker() method algorithm
Follow-up to whatwg/fs#90 Also fixes a use of FileSystemPermissionDescriptor in the showDirectoryPicker() method algorithm
Follow-up to whatwg/fs#90 Also fixes a use of FileSystemPermissionDescriptor in the showDirectoryPicker() method algorithm
Follow-up to whatwg/fs#90 Also fixes a use of FileSystemPermissionDescriptor in the showDirectoryPicker() method algorithm SHA: 739b0c4 Reason: push, by @a-sully Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
See #87 (comment)
Preview | Diff