1. Tobias Dammers
  2. hpaco

Commits

Tobias Dammers  committed 2702b7b

Fixed: defs from included template need to be carried into the current context

  • Participants
  • Parent commits 50cbd1a
  • Branches master

Comments (0)

Files changed (3)

File cli/tests/include.test

View file
  • Ignore whitespace
 Outer (inner)
 >>>= 0
 
+# Carry defs from included template into current context
+./runtest
+<<<
+{}
+
+{%include include/included-def.paco%}
+{%call foobar%}
+>>>
+12345
+>>>= 0

File cli/tests/include/included-def.paco

View file
  • Ignore whitespace
+{%def foobar%}\
+12345
+{%enddef%}

File hpaco-lib/Text/HPaco/Readers/Paco/Include.hs

View file
  • Ignore whitespace
     subAst <- liftIO $ reader fn src
     let stmt = astRootStatement subAst
     modifyState (\s -> s { psDeps = fn:psDeps s ++ astDeps subAst })
+    modifyState (\s -> s { psDefs = psDefs s ++ astDefs subAst })
     return $ maybe stmt (\(ident, expr) -> LetStatement ident expr stmt) innerContext
     where