mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-25 18:51:41 +03:00
Support record update functions for module name lookup table
This commit is contained in:
parent
7455bca8a8
commit
7c0d7e6fad
@ -4986,6 +4986,15 @@ scope_expressionEnterVisitor node context =
|
||||
context.lookupTable
|
||||
}
|
||||
|
||||
Expression.RecordUpdateExpression (Node range name) _ ->
|
||||
{ context
|
||||
| lookupTable =
|
||||
ModuleNameLookupTableInternal.add
|
||||
range
|
||||
(moduleNameForValue context name [])
|
||||
context.lookupTable
|
||||
}
|
||||
|
||||
Expression.LambdaExpression { args } ->
|
||||
{ context
|
||||
| lookupTable =
|
||||
|
@ -46,6 +46,7 @@ a = localValue
|
||||
Foo.Bar
|
||||
Baz.foo
|
||||
baz
|
||||
{ baz | a = 1 }
|
||||
button
|
||||
Http.get
|
||||
get
|
||||
@ -92,6 +93,7 @@ Foo.bar -> Foo.bar
|
||||
Foo.Bar -> Foo.Bar
|
||||
Baz.foo -> Bar.foo
|
||||
<nothing>.baz -> Bar.baz
|
||||
<nothing>.baz -> Bar.baz
|
||||
<nothing>.button -> Html.button
|
||||
Http.get -> Http.get
|
||||
<nothing>.get -> Http.get
|
||||
@ -167,6 +169,22 @@ expressionVisitor node context =
|
||||
in
|
||||
( [], { context | texts = context.texts ++ [ nameInCode ++ " -> " ++ realName ] } )
|
||||
|
||||
Expression.RecordUpdateExpression (Node range name) _ ->
|
||||
let
|
||||
realName : String
|
||||
realName =
|
||||
case ModuleNameLookupTable.moduleNameAt context.lookupTable range of
|
||||
Just [] ->
|
||||
"<nothing>." ++ name
|
||||
|
||||
Just moduleName_ ->
|
||||
String.join "." moduleName_ ++ "." ++ name
|
||||
|
||||
Nothing ->
|
||||
"!!! UNKNOWN !!!"
|
||||
in
|
||||
( [], { context | texts = context.texts ++ [ "<nothing>." ++ name ++ " -> " ++ realName ] } )
|
||||
|
||||
_ ->
|
||||
( [], context )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user