Unify asy conditionals and variables data structure#2494
Unify asy conditionals and variables data structure#2494daved wants to merge 26 commits intoversion/0-39-0-RC1from
Conversation
Naatan
left a comment
There was a problem hiding this comment.
Haven't done a full review as I feel like we can land this without any need for reflection. Figure we should address that before addressing the rest of the review.
| Project *Project | ||
| OS *OS | ||
| Shell string | ||
| Mixin func() *Mixin |
There was a problem hiding this comment.
I'm not seeing why this needs reflection. Why can't we give these values enough information to identify and act on their type differences? eg. add an interface with IsMixing() for example.
pkg/projget/projget.go
Outdated
| projVars := vars.New(auth, vars.NewProject(pj), shell) | ||
| conditional := constraints.NewPrimeConditional(projVars) | ||
| project.RegisterConditional(conditional) | ||
| _ = project.RegisterStruct(projVars) |
There was a problem hiding this comment.
As discussed on call; we shouldn't need reflection to register the top level expanders. The cost of using reflection outweighs the value of having this behave in an automatic way where we can't accidentally introduce a top level conditional without also introducing a top level expander. Top level changes are so rare that it's overkill.
| _ = project.RegisterStruct(projVars) | ||
| } | ||
|
|
||
| pj.SetUpdateCallback(registerProjectVars) |
There was a problem hiding this comment.
Ideally this shouldn't be necessary as we are using the prime version of project.Projectfile, so we should always have access to the latest values already.
| func NewProjectForTest(pjf *projectfile.Project) (*project.Project, error) { | ||
| return newProject(output.Get(), nil, "noshell", pjf) | ||
| } |
There was a problem hiding this comment.
Please move this to a *_test.go file.
|
Closing in favor of #2568. |
Uh oh!
There was an error while loading. Please reload this page.