-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loop arguments added to trace #203
Conversation
ArturGogiyan
commented
Mar 5, 2022
•
edited by ryukzak
Loading
edited by ryukzak
- Console output is broken #192
src/NITTA/LuaFrontend.hs
Outdated
@@ -392,8 +392,13 @@ alg2graph LuaAlgBuilder{algGraph, algLatestLuaValueInstance, algVars} = flip exe | |||
lua2functions src = | |||
let syntaxTree = getLuaBlockFromSources src | |||
luaAlgBuilder = buildAlg syntaxTree | |||
frTrace = getFrTrace $ algTraceFuncs luaAlgBuilder | |||
frTrace = getFrTrace $ getAllTraceFuncs luaAlgBuilder | |||
in FrontendResult{frDataFlow = alg2graph luaAlgBuilder, frTrace = frTrace, frPrettyLog = prettyLog frTrace} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can use NamedFieldPuns
:
in FrontendResult{frDataFlow = alg2graph luaAlgBuilder, frTrace, frPrettyLog = prettyLog frTrace}
Write
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
f1c50dc
to
89092cd
Compare
src/NITTA/LuaFrontend.hs
Outdated
where | ||
getAllTraceFuncs algBuilder = | ||
let traceFuncs = algTraceFuncs algBuilder | ||
startupArgNames = map (\(_, (x, _)) -> x) $ HM.toList $ algStartupArgs algBuilder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this (please, fix if I make a mistake). After change -- merge it.
diff --git a/src/NITTA/LuaFrontend.hs b/src/NITTA/LuaFrontend.hs
index bc3bf643..3950084d 100644
--- a/src/NITTA/LuaFrontend.hs
+++ b/src/NITTA/LuaFrontend.hs
@@ -101,7 +101,7 @@ data LuaAlgBuilder x = LuaAlgBuilder
algVarCounters :: HM.HashMap T.Text Int
, -- | A table lists all uses of a particular LuaValueInstance.
algVars :: HM.HashMap LuaValueInstance [T.Text]
- , -- | A table correlating the ordinal number of an argument with a variable storing its value and startup value of this variable.
+ , -- | Map argument index to the variable name and initial value (in text).
algStartupArgs :: HM.HashMap Int (T.Text, T.Text)
, -- | A table correlating constant with LuaValueInstance which store this constant.
algConstants :: HM.HashMap T.Text LuaValueInstance
@@ -397,7 +397,10 @@ lua2functions src =
where
getAllTraceFuncs algBuilder =
let traceFuncs = algTraceFuncs algBuilder
- startupArgNames = map (\(_, (x, _)) -> x) $ HM.toList $ algStartupArgs algBuilder
+ startupArgNames =
+ map
+ (\(_idx, (varName, _initValue)) -> varName)
+ $ HM.toList $ algStartupArgs algBuilder
in map (\name -> ([name <> "^0"], defaultFmt)) startupArgNames <> traceFuncs
getFrTrace traceFuncs = [TraceVar fmt var | (vars, fmt) <- traceFuncs, var <- vars]
And also I did forget. Can you add a test? |