cap-js / cds-dbs

Monorepo for SQL Database Services for CAP
https://cap.cloud.sap/docs/
Apache License 2.0
37 stars 11 forks source link

refactor(infer): consolidate two main functions #912

Open patricebender opened 1 day ago

patricebender commented 1 day ago

Rework #617

when the infer function was developed, it grew quite fast and some functions were tailor made for very specific use cases. While separation of concerns is a good practice w.r.t. maintainability, the wheel must not be re-invented for each minor deviation in behavior.

That being said, the two function inferQueryElement and attachRefLinksToArg are doing essentially the same. They both walk an arg which is - generally spoken - an expression. That might be a simple ref, func, val or a (nested) xpr.

It is obvious that both functions have significant shared logic. This change removes the usage of the attachRefLinksToArg function.