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

feat: copy structures implementation [fixes LNG-102] #646

Merged
merged 11 commits into from
Jan 20, 2023

Conversation

DieMyst
Copy link
Member

@DieMyst DieMyst commented Jan 19, 2023

fixes LNG-102

@DieMyst DieMyst requested a review from alari January 19, 2023 06:20
@DieMyst DieMyst self-assigned this Jan 19, 2023
@linear
Copy link

linear bot commented Jan 19, 2023

LNG-102 Mutate (copy?) objects

depends on LNG-105

@@ -17,7 +19,7 @@ object ParMode extends MergeMode
* @param mergeMode how `flattenValues` and `predo` must be merged
*/
private[inline] case class Inline(
flattenValues: Map[String, ValueRaw] = Map.empty,
flattenValues: ListMap[String, ValueRaw] = ListMap.empty,
Copy link
Member

Choose a reason for hiding this comment

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

Why ListMap? Comment plz

value match {
case v @ VarModel(name, _, _) =>
for {
name <- Mangler[S].findAndForbidName(name + "_obj_copy")
Copy link
Member

Choose a reason for hiding this comment

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

  • Pattern matching seems unnecessary there
  • Variable shadowing looks overcomplicated, not sure which name is used where

)
case _ =>
State.pure(vm -> Inline.empty)
private def flatVar[S: Mangler: Exports: Arrows](
Copy link
Member

Choose a reason for hiding this comment

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

  • Comment plz, what it does
  • flat is not a verb, maybe flatten? Or removeProperties? Or flattenProperties?
  • It looks like not all the typeclasses are needed here, I see only Mangler used

) { case (state, property) =>
state.flatMap { case (vm, leftInline) =>
unfoldProperty(vm, property).flatMap {
case (v, i) if !propertiesAllowed && v.properties.nonEmpty =>
Copy link
Member

Choose a reason for hiding this comment

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

I cannot say I fully get what happens there

@DieMyst DieMyst changed the title feat: copy structures implementation [LNG-102] feat: copy structures implementation [fixes LNG-102] Jan 20, 2023
@DieMyst DieMyst merged commit 50f0723 into main Jan 20, 2023
@DieMyst DieMyst deleted the LNG-102_copy_structs branch January 20, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants