Shopify / Shopify/tapioca

Refactor the ConstantFound event to take better advantage of polymorphism

Open
#977 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

chore good-first-issue
Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

I wonder if we should do the breakdown of the kinds of constants at push time, so that these become 4 separate events instead:

  1. AliasConstantFound
  2. ValueConstantFound
  3. ModuleConstantFound
  4. ForeignModuleConstantFound < ModuleConstantFound

All we would need to do is to move the logic in compile_constant inside push_constant and the handling becomes much simpler.

Originally posted by @paracycle in https://github.com/Shopify/tapioca/pull/903#discussion_r860921372

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing push_constant and compile_constant, then inspect the current ConstantFound event handling. Compare the event hierarchy with the four proposed event types and update the handling so each constant kind is represented separately; done means the refactor is consistent across the affected event flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.