From 821c1188c04960de1f6d2c5ed4ccb161d9b8ae16 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 24 Apr 2021 21:26:26 -0600 Subject: [PATCH] Fix type errors --- kiss/src/kiss/Macros.hx | 2 ++ projects/asciilib2/src/asciilib/Game.kiss | 22 ++++++++++--------- projects/asciilib2/src/asciilib/Graphics.kiss | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/kiss/src/kiss/Macros.hx b/kiss/src/kiss/Macros.hx index 8fc0525b..d72d6010 100644 --- a/kiss/src/kiss/Macros.hx +++ b/kiss/src/kiss/Macros.hx @@ -521,6 +521,8 @@ class Macros { var bindingList = exps[1].bindingList("defnew"); var bindingPairs = Prelude.groups(bindingList, 2); + // TODO allow &prop in the arg list to bind it directly to a same-named variable + var b = wholeExp.expBuilder(); var propertyDefs = [for (bindingPair in bindingPairs) b.call(b.symbol("defprop"), [bindingPair[0]])]; var propertySetExps = [for (bindingPair in bindingPairs) diff --git a/projects/asciilib2/src/asciilib/Game.kiss b/projects/asciilib2/src/asciilib/Game.kiss index f0b20d12..6453a459 100644 --- a/projects/asciilib2/src/asciilib/Game.kiss +++ b/projects/asciilib2/src/asciilib/Game.kiss @@ -1,13 +1,15 @@ -(defnew [:String title - :Int width - :Int height - :Int letterWidth - :Int letterHeight - :GameLogic gameLogic - :GraphicsBackend _graphicsBackend] - [graphics (new Graphics width height) - logic gameLogic - graphicsBackend _graphicsBackend] +(defnew [title + width + height + letterWidth + letterHeight + _gameLogic + _graphicsBackend] + + // TODO the type annotation on this line feels like a bit much, but is necessary: + [:Graphics graphics (new Graphics width height) + :GameLogic gameLogic _gameLogic + :GraphicsBackend graphicsBackend _graphicsBackend] (graphicsBackend.initialize title width height letterWidth letterHeight)) diff --git a/projects/asciilib2/src/asciilib/Graphics.kiss b/projects/asciilib2/src/asciilib/Graphics.kiss index ae8c3e63..dc8d26f3 100644 --- a/projects/asciilib2/src/asciilib/Graphics.kiss +++ b/projects/asciilib2/src/asciilib/Graphics.kiss @@ -1,2 +1,2 @@ (defnew [width height] - [surface (new Surface width height)]) \ No newline at end of file + [:Surface surface (new Surface width height)]) \ No newline at end of file