Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More object-oriented approach to AST traversal #979

Closed
Rich-Harris opened this issue Dec 5, 2017 · 2 comments
Closed

More object-oriented approach to AST traversal #979

Rich-Harris opened this issue Dec 5, 2017 · 2 comments

Comments

@Rich-Harris
Copy link
Member

Other projects I've worked on that involve a lot of AST traversal and analysis, such as Rollup and Bublé, have converged on an approach that I quite like, whereby the (POJO) nodes of an AST are augmented so that they look and feel like instances of a class, like this example of a FunctionDeclaration node. (The augmentation happens here by setting node.__proto__ — hold your nose if you find that sort of thing distasteful.) The result is a codebase that's a lot neater and reason-about-able than it could easily have devolved into.

It occurred to me just now, while bashing my head against a wall trying to get nodes inside a dynamic component to remount to a new instance's slots, that Svelte would benefit a great deal from a similar approach. It would mean the various 'phases' of compilation were no longer spread across the codebase confusingly, and we could get rid of hacks like this. We could probably even unify the visitors for DOM and SSR compilers.

Definitely a chunky refactor, but now that I can picture it I'm really keen to give it a whirl.

Rich-Harris added a commit that referenced this issue Dec 9, 2017
Rich-Harris added a commit that referenced this issue Dec 10, 2017
@arxpoetica
Copy link
Member

Has this been completed in #992?

@Conduitry
Copy link
Member

Yeah I think this has been completed in #992, closing.

sacrosanctic pushed a commit to sacrosanctic/svelte that referenced this issue Dec 24, 2024
* wip

* Update +server.ts

* Update +server.ts

* wip

* wip

* Update +server.ts

* Update +server.ts

* wip

* cleanup

* wip

* refactor

* cleanupo

* Update +server.ts

* Update content.ts

* wip

* Create +server.ts

* minimize llms.txt

* Filter llms.txt

* clean up

* package

* chore: naming

* Update +server.ts

* Dynamic path names

* clean up

* fix

* under_score

* code style

* use real document titles, filter out empty files

* move llms.txt to llms-small.txt

* llms.txt index

* Update +server.ts

* Update +server.ts

* Fix index

* fix

* revert VERCEL_URL usage

* Update apps/svelte.dev/src/lib/server/content.ts

Co-authored-by: Rich Harris <rich.harris@vercel.com>

* move llm stuff into its own module

* revert whitespace changes

* snake_case

* tweak

* snake_case etc

* make ignores work

* simplify

* unused

* reduce indirection

* more

* move template into separate .md file

* add a section to /docs

* advent of svelte

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants