Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1fun createPerson(name: String, age: Int): Map<String, Any> {
2 return mapOf(
3 "name" to name,
4 "age" to age
5 )
6}
7
8fun main() {
9 val person = createPerson("Alice", 30)
10 println(person)
11}
12

After

1data class Person(val name: String, val age: Int)
2
3fun createPerson(name: String, age: Int): Person {
4 return Person(name, age)
5}
6
7fun main() {
8 val person = createPerson("Alice", 30)
9 println(person)
10}
11

Before

source_file
function_declaration
fun "fun"
identifier "createPerson"
function_value_parameters
( "("
parameter
identifier "name"
: ":"
user_type
identifier "String"
, ","
parameter
identifier "age"
: ":"
user_type
identifier "Int"
) ")"
: ":"
user_type
identifier "Map"
type_arguments
< "<"
type_projection
user_type
identifier "String"
, ","
type_projection
user_type
identifier "Any"
> ">"
function_body
block
{ "{"
return_expression
return "return"
call_expression
identifier "mapOf"
value_arguments
( "("
value_argument
infix_expression
string_literal
" "\""
string_content "name"
" "\""
identifier "to"
identifier "name"
, ","
value_argument
infix_expression
string_literal
" "\""
string_content "age"
" "\""
identifier "to"
identifier "age"
) ")"
} "}"
function_declaration (+35 nodes collapsed)

After

source_file
class_declaration
modifiers
class_modifier
data "data"
class "class"
identifier "Person"
primary_constructor
class_parameters
( "("
class_parameter
val "val"
identifier "name"
: ":"
user_type
identifier "String"
, ","
class_parameter
val "val"
identifier "age"
: ":"
user_type
identifier "Int"
) ")"
function_declaration
fun "fun"
identifier "createPerson"
function_value_parameters
( "("
parameter
identifier "name"
: ":"
user_type
identifier "String"
, ","
parameter
identifier "age"
: ":"
user_type
identifier "Int"
) ")"
: ":"
user_type
identifier "Person"
function_body
block
{ "{"
return_expression
return "return"
call_expression
identifier "Person"
value_arguments
( "("
value_argument
identifier "name"
, ","
value_argument
identifier "age"
) ")"
} "}"
function_declaration (+35 nodes collapsed)