2017-09-19 00:35:37 -07:00
|
|
|
require "lib/core.nom"
|
|
|
|
|
2017-09-28 17:49:15 -07:00
|
|
|
compile (with secrets %block) to block: ".."
|
2017-09-19 00:29:31 -07:00
|
|
|
|local secrets = {}
|
2017-09-28 17:49:15 -07:00
|
|
|
|\(%block as lua statements)
|
2017-09-19 00:29:31 -07:00
|
|
|
|
2017-09-20 03:06:15 -07:00
|
|
|
# Access the lua variable that should be within scope
|
2017-09-28 17:49:15 -07:00
|
|
|
compile (secrets) to: "secrets"
|
|
|
|
|
|
|
|
compile (secret %key; secret value of %key; secret value for %key) to:
|
|
|
|
assert ((%key's "type") == "Var") ".."
|
|
|
|
|Wrong type, expected Var, but got: \(%key's "type")
|
|
|
|
"secrets[\(repr (%key's "value"))]"
|
|
|
|
|
|
|
|
compile (secret %key = %new_value) to code:
|
|
|
|
assert ((%key's "type") == "Var") ".."
|
|
|
|
|Wrong type, expected Var, but got: \(%key's "type")
|
|
|
|
"secrets[\(repr (%key's "value"))] = \(%new_value as lua)"
|
2017-09-19 00:29:31 -07:00
|
|
|
|
2017-09-28 17:49:15 -07:00
|
|
|
with secrets:
|
|
|
|
secret %foo = 5
|
|
|
|
rule (plumb %) =:
|
|
|
|
secret %foo = %
|
|
|
|
rule (frop) =:
|
|
|
|
secret %foo
|
2017-09-19 00:29:31 -07:00
|
|
|
|
2017-09-28 17:49:15 -07:00
|
|
|
say (frop)
|
2017-09-28 18:25:50 -07:00
|
|
|
plumb 99
|
2017-09-28 17:49:15 -07:00
|
|
|
say (frop)
|