Skip to content

Commit 53c0cd5

Browse files
authored
closures wip (#1172)
1 parent 1e35e30 commit 53c0cd5

File tree

15 files changed

+834
-231
lines changed

15 files changed

+834
-231
lines changed

doc/tags.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
| `(nimcall)` | CallConv | `nimcall` calling convention |
128128
| `(inline)` | NifcPragma, NimonyPragma, NifIndexKind | `inline` proc annotation |
129129
| `(noinline)` | NifcPragma, NimonyPragma | `noinline` proc annotation |
130+
| `(closure)` | NimonyPragma | `closure` proc annotation; not a calling convention anymore, simply annotates a proc as a closure |
130131
| `(attr STR)` | NifcPragma | general attribute annoation |
131132
| `(varargs)` | NifcPragma, NimonyPragma, NimonyType | `varargs` proc annotation |
132133
| `(was STR)` | NifcPragma | |
@@ -292,3 +293,4 @@
292293
| `(internalFieldPairs T X)` | NimonyExpr | variant of fieldPairs iterator returns compiler's internal field name |
293294
| `(failed X)` | NimonyExpr | used to access the hidden failure flag for raising calls |
294295
| `(is X T)` | NimonyExpr | `is` operator |
296+
| `(envp T Y)` | NimonyExpr | `envp.Y` field access to hidden `env` parameter which is of type `T` |

src/hexer/desugar.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ proc tr(c: var Context; dest: var TokenBuf; n: var Cursor; isTopScope = false) =
736736
of ProcS, FuncS, MacroS, MethodS, ConverterS:
737737
trProc c, dest, n
738738
of IteratorS, TemplateS, EmitS, BreakS, ContinueS,
739-
ForS, CmdS, IncludeS, ImportS, FromimportS, ImportExceptS,
739+
ForS, IncludeS, ImportS, FromimportS, ImportExceptS,
740740
ExportS, CommentS,
741741
PragmasS:
742742
takeTree dest, n

src/hexer/duplifier.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,8 @@ proc tr(c: var Context; n: var Cursor; e: Expects) =
916916
trDeref c, n
917917
of DdotX:
918918
bug "nodekind should have been eliminated in desugar.nim"
919+
of EnvpX:
920+
bug "envp should have been eliminated in lambdalifting.nim"
919921
of DefaultobjX, DefaulttupX, BracketX, CurlyX, TupX:
920922
bug "nodekind should have been eliminated in sem.nim"
921923
of PragmaxX, CurlyatX, TabconstrX, DoX, FailedX:

0 commit comments

Comments
 (0)