Mihaela Chirea - SAOC 2020 Milestone 2 Update 4 - Improving DMD as a Library
doob at me.com
Fri Nov 27 20:47:37 UTC 2020
On 2020-11-26 20:04, Mihaela Chirea wrote:
> The main problem here is that there are quite a lot of node types using
> stc this way so both of these options would require significant changes.
> I'll check the locations of the rest of the nodes as well to see if any
> of them include the storage classes.
I did some tests with the parser. For code like this: `const a = 3;`,
the parser creates a `VarDeclaration` node, with the storage class set
in `storage_class`. If the code looks like this: `const int a = 3;`, it
creates the exact same node, but it also wraps that in a
`StorageClassDeclaration` node. If the parse is already doing that, the
semantic analyzer need to be able to handle both cases.
So you should be able to modify the first case so that it wraps the
`VarDeclaration` inside a `StorageClassDeclaration`. Pass the same
storage class to `StorageClassDeclaration` as the existing code passes
to `VarDeclaration`. It only requires to add couple of lines here .
I've tested this. It works to parse and run the semantic analyzer on
both of the above code snippets with the change to the parser applied.
But I haven't run the full test suite.
More information about the Digitalmars-d