Skip to content

Revive TypeWriter#464

Merged
JsonFreeman merged 20 commits into
masterfrom
typeWriter
Aug 19, 2014
Merged

Revive TypeWriter#464
JsonFreeman merged 20 commits into
masterfrom
typeWriter

Conversation

@JsonFreeman
Copy link
Copy Markdown
Contributor

This change adds back the typeWriter pass on all the compiler tests. The typeWriter walks the tree and prints the types of all expressions and nodes (it actually tries to pick the same node kinds as the old typeWriter). It gets the type of every node, using the getTypeOfNode function (new in this review). If it gets unknownType, it just prints the name of the node. That fallback is mostly used for namespaces, which have no types associated with them (again, we want to resemble the old type writer as much as possible for now).

I've added some publicly exposed functions to the checker. The main one is getTypeOfNode, but I have altered and removed a few others.

Some tests crashed when run with typeWriter. I have opened bugs for these.

We still have a bunch of work to do to make the new type baselines look like the old ones in order to do a baseline comparison.

Comment thread src/compiler/checker.ts Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if this name is the parent's name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i think this code is fine. But here's my concern. It highly depends on the shape of the AST, and ensuring htat hte only identiier a type declaration can point at is the 'name' portion. This may not always be true.

IMO, you should add one additional check that (name.parent).name == identifier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants