mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
support optional suffied last def
This commit is contained in:
parent
4625926486
commit
c32fa5b600
17 changed files with 603 additions and 269 deletions
|
@ -1,5 +1,5 @@
|
|||
main =
|
||||
a! "Bar"
|
||||
x = B.b! "Foo"
|
||||
|
||||
x =
|
||||
B.b! "Foo"
|
||||
c! x
|
||||
|
|
|
@ -3,7 +3,7 @@ Defs {
|
|||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-20,
|
||||
@0-21,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
|
@ -19,23 +19,27 @@ Defs {
|
|||
ident: "main",
|
||||
suffixed: 0,
|
||||
},
|
||||
@0-20 Defs(
|
||||
@0-21 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
Index(2147483649),
|
||||
Index(2147483650),
|
||||
],
|
||||
regions: [
|
||||
@0-20,
|
||||
@25-37,
|
||||
@0-21,
|
||||
@26-39,
|
||||
@45-49,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 0, length = 1),
|
||||
Slice(start = 1, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 1, length = 0),
|
||||
Slice(start = 1, length = 0),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
|
@ -43,7 +47,7 @@ Defs {
|
|||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@12-20 SpaceBefore(
|
||||
@12-21 SpaceBefore(
|
||||
Apply(
|
||||
@12-14 Var {
|
||||
module_name: "",
|
||||
|
@ -51,7 +55,7 @@ Defs {
|
|||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@15-20 Str(
|
||||
@16-21 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
|
@ -65,49 +69,77 @@ Defs {
|
|||
),
|
||||
),
|
||||
Body(
|
||||
@25-26 Identifier {
|
||||
@26-27 Identifier {
|
||||
ident: "x",
|
||||
suffixed: 0,
|
||||
},
|
||||
@27-37 Apply(
|
||||
@27-31 Var {
|
||||
module_name: "B",
|
||||
ident: "b",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@32-37 Str(
|
||||
PlainLine(
|
||||
"Foo",
|
||||
@26-39 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@29-39,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 1, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 1, length = 0),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@29-39 Apply(
|
||||
@29-33 Var {
|
||||
module_name: "B",
|
||||
ident: "b",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@34-39 Str(
|
||||
PlainLine(
|
||||
"Foo",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
EmptyDefsFinal,
|
||||
),
|
||||
),
|
||||
Stmt(
|
||||
@45-49 SpaceBefore(
|
||||
Apply(
|
||||
@45-47 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@48-49 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
suffixed: 0,
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@43-47 SpaceBefore(
|
||||
Apply(
|
||||
@43-45 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@46-47 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
suffixed: 0,
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
EmptyDefsFinal,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
main =
|
||||
a! "Bar"
|
||||
x=B.b! "Foo"
|
||||
a! "Bar"
|
||||
x= B.b! "Foo"
|
||||
|
||||
c! x
|
|
@ -10,9 +10,10 @@ app "desugar-bang"
|
|||
main =
|
||||
# is this a valid statement?
|
||||
"Foo" |> A.x!
|
||||
|
||||
# what about this?
|
||||
"Bar"
|
||||
|> B.y!
|
||||
{ config: "config" }
|
||||
|> B.y!
|
||||
{ config: "config" }
|
||||
|
||||
C.z "Bar"
|
||||
|
|
|
@ -98,7 +98,7 @@ Full {
|
|||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@155-212,
|
||||
@155-299,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 2),
|
||||
|
@ -117,30 +117,26 @@ Full {
|
|||
ident: "main",
|
||||
suffixed: 0,
|
||||
},
|
||||
@155-212 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
Index(2147483649),
|
||||
],
|
||||
regions: [
|
||||
@155-212,
|
||||
@241-284,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@199-212 SpaceBefore(
|
||||
BinOps(
|
||||
@199-299 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@199-212,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@199-212 BinOps(
|
||||
[
|
||||
(
|
||||
@199-204 Str(
|
||||
|
@ -157,88 +153,108 @@ Full {
|
|||
suffixed: 1,
|
||||
},
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
LineComment(
|
||||
" is this a valid statement?",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Stmt(
|
||||
@241-284 SpaceBefore(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@241-246 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
),
|
||||
@247-249 Pizza,
|
||||
),
|
||||
],
|
||||
@250-284 Apply(
|
||||
@250-254 Var {
|
||||
module_name: "B",
|
||||
ident: "y",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@264-284 SpaceBefore(
|
||||
Record(
|
||||
[
|
||||
@266-282 RequiredValue(
|
||||
@266-272 "config",
|
||||
[],
|
||||
@274-282 Str(
|
||||
PlainLine(
|
||||
"config",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
LineComment(
|
||||
" what about this?",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@290-299 SpaceBefore(
|
||||
Apply(
|
||||
@290-293 Var {
|
||||
module_name: "C",
|
||||
ident: "z",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
@294-299 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
},
|
||||
@241-299 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@241-284,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@241-284 BinOps(
|
||||
[
|
||||
(
|
||||
@241-246 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
),
|
||||
@247-249 Pizza,
|
||||
),
|
||||
],
|
||||
@250-284 Apply(
|
||||
@250-254 Var {
|
||||
module_name: "B",
|
||||
ident: "y",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@264-284 SpaceBefore(
|
||||
Record(
|
||||
[
|
||||
@266-282 RequiredValue(
|
||||
@266-272 "config",
|
||||
[],
|
||||
@274-282 Str(
|
||||
PlainLine(
|
||||
"config",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@290-299 SpaceBefore(
|
||||
Apply(
|
||||
@290-293 Var {
|
||||
module_name: "C",
|
||||
ident: "z",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
@294-299 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
LineComment(
|
||||
" what about this?",
|
||||
),
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
LineComment(
|
||||
" is this a valid statement?",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,6 +7,6 @@ app ""
|
|||
|
||||
main =
|
||||
"jq --version"
|
||||
|> Cmd.new
|
||||
|> Cmd.status
|
||||
|> Task.mapErr! UnableToCheckJQVersion
|
||||
|> Cmd.new
|
||||
|> Cmd.status
|
||||
|> Task.mapErr! UnableToCheckJQVersion
|
||||
|
|
|
@ -99,62 +99,85 @@ Full {
|
|||
ident: "main",
|
||||
suffixed: 0,
|
||||
},
|
||||
@88-202 SpaceBefore(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@100-114 SpaceAfter(
|
||||
Str(
|
||||
PlainLine(
|
||||
"jq --version",
|
||||
@100-202 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@145-202,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@145-202 BinOps(
|
||||
[
|
||||
(
|
||||
@100-114 SpaceAfter(
|
||||
Str(
|
||||
PlainLine(
|
||||
"jq --version",
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@123-125 Pizza,
|
||||
),
|
||||
(
|
||||
@126-133 SpaceAfter(
|
||||
Var {
|
||||
module_name: "Cmd",
|
||||
ident: "new",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@142-144 Pizza,
|
||||
),
|
||||
(
|
||||
@145-155 SpaceAfter(
|
||||
Var {
|
||||
module_name: "Cmd",
|
||||
ident: "status",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@164-166 Pizza,
|
||||
),
|
||||
],
|
||||
@167-202 Apply(
|
||||
@167-179 Var {
|
||||
module_name: "Task",
|
||||
ident: "mapErr",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@180-202 Tag(
|
||||
"UnableToCheckJQVersion",
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@123-125 Pizza,
|
||||
),
|
||||
(
|
||||
@126-133 SpaceAfter(
|
||||
Var {
|
||||
module_name: "Cmd",
|
||||
ident: "new",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@142-144 Pizza,
|
||||
),
|
||||
(
|
||||
@145-155 SpaceAfter(
|
||||
Var {
|
||||
module_name: "Cmd",
|
||||
ident: "status",
|
||||
suffixed: 0,
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@164-166 Pizza,
|
||||
),
|
||||
],
|
||||
@167-202 Apply(
|
||||
@167-179 Var {
|
||||
module_name: "Task",
|
||||
ident: "mapErr",
|
||||
suffixed: 1,
|
||||
},
|
||||
[
|
||||
@180-202 Tag(
|
||||
"UnableToCheckJQVersion",
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
},
|
||||
EmptyDefsFinal,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue