Skip to content

json interpolator - #424

Open
a-khakimov wants to merge 1 commit into
tethys-json:masterfrom
a-khakimov:json-interpolator
Open

a-khakimov wants to merge 1 commit into
tethys-json:masterfrom
a-khakimov:json-interpolator

Conversation

@a-khakimov

Copy link
Copy Markdown

@dos65 dos65 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Извиняюсь за долгое ревью.
Спасибо за фичу. Отличный пр.

Единственное, думаю было бы классно еще чтобы интерполятор внутри строк в жсоне работал, но это можно в ишью отдельные будет потом закинуть

Я чутка комментов оставил минорных

)
}

val argTrees: List[Tree] = args.iterator.map(_.tree).toList

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
val argTrees: List[Tree] = args.iterator.map(_.tree).toList
val argTrees: List[Tree] = args.map(_.tree).toList

}

val positionByIndex: Map[Int, HolePosition] =
holes.iterator.map(h => h.index -> h.position).toMap

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
holes.iterator.map(h => h.index -> h.position).toMap
holes.map(h => h.index -> h.position).toMap

holes.iterator.map(h => h.index -> h.position).toMap

def renderValue(arg: Tree): Tree = {
val tpe = c.typecheck(arg.duplicate, silent = false).tpe.widen

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

а есть какая-то причина тут звать тайпчек, а не arg.tpe ?

)

val positionByIndex: Map[Int, HolePosition] =
holes.iterator.map(h => h.index -> h.position).toMap

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
holes.iterator.map(h => h.index -> h.position).toMap
holes.map(h => h.index -> h.position).toMap


def findHoleInString(parts: List[String]): Int = {
var i = 0
while (i < parts.length - 1) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

вот тут неэффективные вызовы на листе - parts.length + parts.apply(idx) ниже

мб через parts.iterator сделать?

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