Skip to content

Commit 0e6838b

Browse files
Merge pull request #49 from Shopify/fix-iteration-order
tecnix: intern builtin argument names at call time, not statically
2 parents 2d31df4 + f50ab9b commit 0e6838b

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/libexpr/include/nix/expr/eval.hh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,9 @@ struct StaticEvalSymbols
243243
{
244244
Symbol with, outPath, drvPath, type, meta, name, value, system, overrides, outputs, outputName, ignoreNulls, file,
245245
line, column, functor, toString, right, wrong, structuredAttrs, json, allowedReferences, allowedRequisites,
246-
disallowedReferences, disallowedRequisites, maxSize, maxClosureSize, builder, args, gitDir, resolver, rev,
247-
checkoutPath, targets, contentAddressed, impure, outputHash, outputHashAlgo, outputHashMode,
248-
recurseForDerivations, description, self, epsilon, startSet, operator_, key, path, prefix, outputSpecified,
249-
__meta;
246+
disallowedReferences, disallowedRequisites, maxSize, maxClosureSize, builder, args, contentAddressed, impure,
247+
outputHash, outputHashAlgo, outputHashMode, recurseForDerivations, description, self, epsilon, startSet,
248+
operator_, key, path, prefix, outputSpecified, __meta;
250249

251250
Expr::AstSymbols exprSymbols;
252251

@@ -284,11 +283,6 @@ struct StaticEvalSymbols
284283
.maxClosureSize = alloc.create("maxClosureSize"),
285284
.builder = alloc.create("builder"),
286285
.args = alloc.create("args"),
287-
.gitDir = alloc.create("gitDir"),
288-
.resolver = alloc.create("resolver"),
289-
.rev = alloc.create("rev"),
290-
.checkoutPath = alloc.create("checkoutPath"),
291-
.targets = alloc.create("targets"),
292286
.contentAddressed = alloc.create("__contentAddressed"),
293287
.impure = alloc.create("__impure"),
294288
.outputHash = alloc.create("outputHash"),

src/libexpr/primops/tecnix.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static std::string
129129
resolveRev(EvalState & state, const PosIdx pos, const Bindings & attrs, const std::string & checkoutPath)
130130
{
131131
// Check for explicit rev attr
132-
auto revAttr = attrs.get(state.s.rev);
132+
auto revAttr = attrs.get(state.symbols.create("rev"));
133133
if (revAttr) {
134134
auto sha = state.forceStringNoCtx(*revAttr->value, pos, "while evaluating the 'rev' argument");
135135
if (!sha.empty())
@@ -181,19 +181,19 @@ static const Bindings & forceTecnixBuiltinAttrs(EvalState & state, const PosIdx
181181

182182
static void parseTecnixRepoArgs(EvalState & state, const PosIdx pos, const Bindings & attrs, TecnixArgs & result)
183183
{
184-
auto gitDirAttr = attrs.get(state.s.gitDir);
184+
auto gitDirAttr = attrs.get(state.symbols.create("gitDir"));
185185
if (!gitDirAttr)
186186
state.error<EvalError>("'gitDir' attribute required").atPos(pos).debugThrow();
187187
result.gitDir =
188188
std::string(state.forceStringNoCtx(*gitDirAttr->value, pos, "while evaluating the 'gitDir' argument"));
189189

190-
auto resolverAttr = attrs.get(state.s.resolver);
190+
auto resolverAttr = attrs.get(state.symbols.create("resolver"));
191191
if (!resolverAttr)
192192
state.error<EvalError>("'resolver' attribute required").atPos(pos).debugThrow();
193193
result.resolver =
194194
std::string(state.forceStringNoCtx(*resolverAttr->value, pos, "while evaluating the 'resolver' argument"));
195195

196-
auto checkoutPathAttr = attrs.get(state.s.checkoutPath);
196+
auto checkoutPathAttr = attrs.get(state.symbols.create("checkoutPath"));
197197
if (checkoutPathAttr)
198198
result.checkoutPath = std::string(
199199
state.forceStringNoCtx(*checkoutPathAttr->value, pos, "while evaluating the 'checkoutPath' argument"));
@@ -273,7 +273,7 @@ parseTecnixResolverArgsValue(EvalState & state, const PosIdx pos, const Bindings
273273

274274
static std::vector<std::string> parseTecnixTargets(EvalState & state, const PosIdx pos, const Bindings & attrs)
275275
{
276-
auto targetsAttr = attrs.get(state.s.targets);
276+
auto targetsAttr = attrs.get(state.symbols.create("targets"));
277277
if (!targetsAttr)
278278
state.error<EvalError>("'targets' attribute required").atPos(pos).debugThrow();
279279

0 commit comments

Comments
 (0)