fix(3p/nix): Compatibility with updated SymbolTable
The functions in SymbolTable have been renamed to match the Google Style guide, and some debug-only functions have been removed.
This commit is contained in:
		
							parent
							
								
									97e85f94e5
								
							
						
					
					
						commit
						c395a48be2
					
				
					 21 changed files with 141 additions and 137 deletions
				
			
		
							
								
								
									
										2
									
								
								third_party/nix/src/libexpr/attr-path.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								third_party/nix/src/libexpr/attr-path.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -75,7 +75,7 @@ Value* findAlongAttrPath(EvalState& state, const string& attrPath,
 | 
			
		|||
                    attrPath);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
 | 
			
		||||
      Bindings::iterator a = v->attrs->find(state.symbols.Create(attr));
 | 
			
		||||
      if (a == v->attrs->end()) {
 | 
			
		||||
        throw Error(
 | 
			
		||||
            format("attribute '%1%' in selection path '%2%' not found") % attr %
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ Bindings* MixEvalArgs::getAutoArgs(EvalState& state) {
 | 
			
		|||
    } else {
 | 
			
		||||
      mkString(*v, string(i.second, 1));
 | 
			
		||||
    }
 | 
			
		||||
    res->push_back(Attr(state.symbols.create(i.first), v));
 | 
			
		||||
    res->push_back(Attr(state.symbols.Create(i.first), v));
 | 
			
		||||
  }
 | 
			
		||||
  res->sort();
 | 
			
		||||
  return res;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										77
									
								
								third_party/nix/src/libexpr/eval.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										77
									
								
								third_party/nix/src/libexpr/eval.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -198,7 +198,7 @@ static Symbol getName(const AttrName& name, EvalState& state, Env& env) {
 | 
			
		|||
  Value nameValue;
 | 
			
		||||
  name.expr->eval(state, env, nameValue);
 | 
			
		||||
  state.forceStringNoCtx(nameValue);
 | 
			
		||||
  return state.symbols.create(nameValue.string.s);
 | 
			
		||||
  return state.symbols.Create(nameValue.string.s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool gcInitialised = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -299,31 +299,31 @@ static Strings parseNixPath(const string& s) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
EvalState::EvalState(const Strings& _searchPath, const ref<Store>& store)
 | 
			
		||||
    : sWith(symbols.create("<with>")),
 | 
			
		||||
      sOutPath(symbols.create("outPath")),
 | 
			
		||||
      sDrvPath(symbols.create("drvPath")),
 | 
			
		||||
      sType(symbols.create("type")),
 | 
			
		||||
      sMeta(symbols.create("meta")),
 | 
			
		||||
      sName(symbols.create("name")),
 | 
			
		||||
      sValue(symbols.create("value")),
 | 
			
		||||
      sSystem(symbols.create("system")),
 | 
			
		||||
      sOverrides(symbols.create("__overrides")),
 | 
			
		||||
      sOutputs(symbols.create("outputs")),
 | 
			
		||||
      sOutputName(symbols.create("outputName")),
 | 
			
		||||
      sIgnoreNulls(symbols.create("__ignoreNulls")),
 | 
			
		||||
      sFile(symbols.create("file")),
 | 
			
		||||
      sLine(symbols.create("line")),
 | 
			
		||||
      sColumn(symbols.create("column")),
 | 
			
		||||
      sFunctor(symbols.create("__functor")),
 | 
			
		||||
      sToString(symbols.create("__toString")),
 | 
			
		||||
      sRight(symbols.create("right")),
 | 
			
		||||
      sWrong(symbols.create("wrong")),
 | 
			
		||||
      sStructuredAttrs(symbols.create("__structuredAttrs")),
 | 
			
		||||
      sBuilder(symbols.create("builder")),
 | 
			
		||||
      sArgs(symbols.create("args")),
 | 
			
		||||
      sOutputHash(symbols.create("outputHash")),
 | 
			
		||||
      sOutputHashAlgo(symbols.create("outputHashAlgo")),
 | 
			
		||||
      sOutputHashMode(symbols.create("outputHashMode")),
 | 
			
		||||
    : sWith(symbols.Create("<with>")),
 | 
			
		||||
      sOutPath(symbols.Create("outPath")),
 | 
			
		||||
      sDrvPath(symbols.Create("drvPath")),
 | 
			
		||||
      sType(symbols.Create("type")),
 | 
			
		||||
      sMeta(symbols.Create("meta")),
 | 
			
		||||
      sName(symbols.Create("name")),
 | 
			
		||||
      sValue(symbols.Create("value")),
 | 
			
		||||
      sSystem(symbols.Create("system")),
 | 
			
		||||
      sOverrides(symbols.Create("__overrides")),
 | 
			
		||||
      sOutputs(symbols.Create("outputs")),
 | 
			
		||||
      sOutputName(symbols.Create("outputName")),
 | 
			
		||||
      sIgnoreNulls(symbols.Create("__ignoreNulls")),
 | 
			
		||||
      sFile(symbols.Create("file")),
 | 
			
		||||
      sLine(symbols.Create("line")),
 | 
			
		||||
      sColumn(symbols.Create("column")),
 | 
			
		||||
      sFunctor(symbols.Create("__functor")),
 | 
			
		||||
      sToString(symbols.Create("__toString")),
 | 
			
		||||
      sRight(symbols.Create("right")),
 | 
			
		||||
      sWrong(symbols.Create("wrong")),
 | 
			
		||||
      sStructuredAttrs(symbols.Create("__structuredAttrs")),
 | 
			
		||||
      sBuilder(symbols.Create("builder")),
 | 
			
		||||
      sArgs(symbols.Create("args")),
 | 
			
		||||
      sOutputHash(symbols.Create("outputHash")),
 | 
			
		||||
      sOutputHashAlgo(symbols.Create("outputHashAlgo")),
 | 
			
		||||
      sOutputHashMode(symbols.Create("outputHashMode")),
 | 
			
		||||
      repair(NoRepair),
 | 
			
		||||
      store(store),
 | 
			
		||||
      baseEnv(allocEnv(128)),
 | 
			
		||||
| 
						 | 
				
			
			@ -467,10 +467,10 @@ Path EvalState::toRealPath(const Path& path, const PathSet& context) {
 | 
			
		|||
Value* EvalState::addConstant(const string& name, Value& v) {
 | 
			
		||||
  Value* v2 = allocValue();
 | 
			
		||||
  *v2 = v;
 | 
			
		||||
  staticBaseEnv.vars[symbols.create(name)] = baseEnvDispl;
 | 
			
		||||
  staticBaseEnv.vars[symbols.Create(name)] = baseEnvDispl;
 | 
			
		||||
  baseEnv.values[baseEnvDispl++] = v2;
 | 
			
		||||
  string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
 | 
			
		||||
  baseEnv.values[0]->attrs->push_back(Attr(symbols.create(name2), v2));
 | 
			
		||||
  baseEnv.values[0]->attrs->push_back(Attr(symbols.Create(name2), v2));
 | 
			
		||||
  return v2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -483,17 +483,17 @@ Value* EvalState::addPrimOp(const string& name, size_t arity,
 | 
			
		|||
  }
 | 
			
		||||
  Value* v = allocValue();
 | 
			
		||||
  string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
 | 
			
		||||
  Symbol sym = symbols.create(name2);
 | 
			
		||||
  Symbol sym = symbols.Create(name2);
 | 
			
		||||
  v->type = tPrimOp;
 | 
			
		||||
  v->primOp = new PrimOp(primOp, arity, sym);
 | 
			
		||||
  staticBaseEnv.vars[symbols.create(name)] = baseEnvDispl;
 | 
			
		||||
  staticBaseEnv.vars[symbols.Create(name)] = baseEnvDispl;
 | 
			
		||||
  baseEnv.values[baseEnvDispl++] = v;
 | 
			
		||||
  baseEnv.values[0]->attrs->push_back(Attr(sym, v));
 | 
			
		||||
  return v;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Value& EvalState::getBuiltin(const string& name) {
 | 
			
		||||
  return *baseEnv.values[0]->attrs->find(symbols.create(name))->value;
 | 
			
		||||
  return *baseEnv.values[0]->attrs->find(symbols.Create(name))->value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Every "format" object (even temporary) takes up a few hundred bytes
 | 
			
		||||
| 
						 | 
				
			
			@ -885,7 +885,7 @@ void ExprAttrs::eval(EvalState& state, Env& env, Value& v) {
 | 
			
		|||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
    state.forceStringNoCtx(nameVal);
 | 
			
		||||
    Symbol nameSym = state.symbols.create(nameVal.string.s);
 | 
			
		||||
    Symbol nameSym = state.symbols.Create(nameVal.string.s);
 | 
			
		||||
    Bindings::iterator j = v.attrs->find(nameSym);
 | 
			
		||||
    if (j != v.attrs->end()) {
 | 
			
		||||
      throwEvalError("dynamic attribute '%1%' at %2% already defined at %3%",
 | 
			
		||||
| 
						 | 
				
			
			@ -1828,8 +1828,8 @@ void EvalState::printStats() {
 | 
			
		|||
    }
 | 
			
		||||
    {
 | 
			
		||||
      auto syms = topObj.object("symbols");
 | 
			
		||||
      syms.attr("number", symbols.size());
 | 
			
		||||
      syms.attr("bytes", symbols.totalSize());
 | 
			
		||||
      syms.attr("number", symbols.Size());
 | 
			
		||||
      syms.attr("bytes", symbols.TotalSize());
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
      auto sets = topObj.object("sets");
 | 
			
		||||
| 
						 | 
				
			
			@ -1897,10 +1897,11 @@ void EvalState::printStats() {
 | 
			
		|||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (getEnv("NIX_SHOW_SYMBOLS", "0") != "0") {
 | 
			
		||||
      auto list = topObj.list("symbols");
 | 
			
		||||
      symbols.dump([&](const std::string& s) { list.elem(s); });
 | 
			
		||||
    }
 | 
			
		||||
    // TODO(tazjin): what is this? commented out because .dump() is gone.
 | 
			
		||||
    // if (getEnv("NIX_SHOW_SYMBOLS", "0") != "0") {
 | 
			
		||||
    //   auto list = topObj.list("symbols");
 | 
			
		||||
    //   symbols.dump([&](const std::string& s) { list.elem(s); });
 | 
			
		||||
    // }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								third_party/nix/src/libexpr/get-drvs.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								third_party/nix/src/libexpr/get-drvs.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -99,7 +99,7 @@ DrvInfo::Outputs DrvInfo::queryOutputs(bool onlyOutputsToInstall) {
 | 
			
		|||
        /* Evaluate the corresponding set. */
 | 
			
		||||
        string name =
 | 
			
		||||
            state->forceStringNoCtx(*i->value->listElems()[j], *i->pos);
 | 
			
		||||
        Bindings::iterator out = attrs->find(state->symbols.create(name));
 | 
			
		||||
        Bindings::iterator out = attrs->find(state->symbols.Create(name));
 | 
			
		||||
        if (out == attrs->end()) {
 | 
			
		||||
          continue;  // FIXME: throw error?
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -213,7 +213,7 @@ Value* DrvInfo::queryMeta(const string& name) {
 | 
			
		|||
  if (getMeta() == nullptr) {
 | 
			
		||||
    return nullptr;
 | 
			
		||||
  }
 | 
			
		||||
  Bindings::iterator a = meta->find(state->symbols.create(name));
 | 
			
		||||
  Bindings::iterator a = meta->find(state->symbols.Create(name));
 | 
			
		||||
  if (a == meta->end() || !checkMeta(*a->value)) {
 | 
			
		||||
    return nullptr;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -291,7 +291,7 @@ void DrvInfo::setMeta(const string& name, Value* v) {
 | 
			
		|||
  getMeta();
 | 
			
		||||
  Bindings* old = meta;
 | 
			
		||||
  meta = state->allocBindings(1 + (old != nullptr ? old->size() : 0));
 | 
			
		||||
  Symbol sym = state->symbols.create(name);
 | 
			
		||||
  Symbol sym = state->symbols.Create(name);
 | 
			
		||||
  if (old != nullptr) {
 | 
			
		||||
    for (auto i : *old) {
 | 
			
		||||
      if (i.name != sym) {
 | 
			
		||||
| 
						 | 
				
			
			@ -377,7 +377,7 @@ static void getDerivations(EvalState& state, Value& vIn,
 | 
			
		|||
    /* !!! undocumented hackery to support combining channels in
 | 
			
		||||
       nix-env.cc. */
 | 
			
		||||
    bool combineChannels =
 | 
			
		||||
        v.attrs->find(state.symbols.create("_combineChannels")) !=
 | 
			
		||||
        v.attrs->find(state.symbols.Create("_combineChannels")) !=
 | 
			
		||||
        v.attrs->end();
 | 
			
		||||
 | 
			
		||||
    /* Consider the attributes in sorted order to get more
 | 
			
		||||
| 
						 | 
				
			
			@ -401,7 +401,7 @@ static void getDerivations(EvalState& state, Value& vIn,
 | 
			
		|||
           `recurseForDerivations = true' attribute. */
 | 
			
		||||
        if (i->value->type == tAttrs) {
 | 
			
		||||
          Bindings::iterator j = i->value->attrs->find(
 | 
			
		||||
              state.symbols.create("recurseForDerivations"));
 | 
			
		||||
              state.symbols.Create("recurseForDerivations"));
 | 
			
		||||
          if (j != i->value->attrs->end() &&
 | 
			
		||||
              state.forceBool(*j->value, *j->pos)) {
 | 
			
		||||
            getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								third_party/nix/src/libexpr/json-to-value.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								third_party/nix/src/libexpr/json-to-value.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -105,7 +105,7 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
 | 
			
		|||
      s++;
 | 
			
		||||
      Value* v2 = state.allocValue();
 | 
			
		||||
      parseJSON(state, s, *v2);
 | 
			
		||||
      attrs[state.symbols.create(name)] = v2;
 | 
			
		||||
      attrs[state.symbols.Create(name)] = v2;
 | 
			
		||||
      skipWhitespace(s);
 | 
			
		||||
      if (*s == '}') {
 | 
			
		||||
        break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								third_party/nix/src/libexpr/lexer.l
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								third_party/nix/src/libexpr/lexer.l
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -72,7 +72,7 @@ static Expr * unescapeStr(SymbolTable & symbols, const char * s, size_t length)
 | 
			
		|||
        }
 | 
			
		||||
        else t += c;
 | 
			
		||||
    }
 | 
			
		||||
    return new ExprString(symbols.create(t));
 | 
			
		||||
    return new ExprString(symbols.Create(t));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								third_party/nix/src/libexpr/meson.build
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								third_party/nix/src/libexpr/meson.build
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -16,6 +16,7 @@ libexpr_src = files(
 | 
			
		|||
    join_paths(meson.source_root(), 'src/libexpr/names.cc'),
 | 
			
		||||
    join_paths(meson.source_root(), 'src/libexpr/nixexpr.cc'),
 | 
			
		||||
    join_paths(meson.source_root(), 'src/libexpr/primops.cc'),
 | 
			
		||||
    join_paths(meson.source_root(), 'src/libexpr/symbol-table.cc'),
 | 
			
		||||
    join_paths(meson.source_root(), 'src/libexpr/value-to-json.cc'),
 | 
			
		||||
    join_paths(meson.source_root(), 'src/libexpr/value-to-xml.cc'),
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -42,18 +43,17 @@ libexpr_dep_list = [
 | 
			
		|||
    glog_dep,
 | 
			
		||||
    libdl_dep,
 | 
			
		||||
    libsodium_dep,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
if sys_name == 'freebsd'
 | 
			
		||||
    libexpr_dep_list += libdl_dep
 | 
			
		||||
endif
 | 
			
		||||
] + absl_deps
 | 
			
		||||
 | 
			
		||||
libexpr_link_list = [
 | 
			
		||||
    libutil_lib,
 | 
			
		||||
    libstore_lib,
 | 
			
		||||
    libmain_lib]
 | 
			
		||||
    libmain_lib,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libexpr_link_args = []
 | 
			
		||||
libexpr_link_args = [
 | 
			
		||||
  '-lpthread',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libexpr_cxx_args = []
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										58
									
								
								third_party/nix/src/libexpr/parser.y
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										58
									
								
								third_party/nix/src/libexpr/parser.y
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -35,7 +35,7 @@ namespace nix {
 | 
			
		|||
        ParseData(EvalState & state)
 | 
			
		||||
            : state(state)
 | 
			
		||||
            , symbols(state.symbols)
 | 
			
		||||
            , sLetBody(symbols.create("<let-body>"))
 | 
			
		||||
            , sLetBody(symbols.Create("<let-body>"))
 | 
			
		||||
            { };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ static void addFormal(const Pos & pos, Formals * formals, const Formal & formal)
 | 
			
		|||
 | 
			
		||||
static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, vector<Expr *> & es)
 | 
			
		||||
{
 | 
			
		||||
    if (es.empty()) { return new ExprString(symbols.create("")); }
 | 
			
		||||
    if (es.empty()) { return new ExprString(symbols.Create("")); }
 | 
			
		||||
 | 
			
		||||
    /* Figure out the minimum indentation.  Note that by design
 | 
			
		||||
       whitespace-only final lines are not taken into account.  (So
 | 
			
		||||
| 
						 | 
				
			
			@ -228,7 +228,7 @@ static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, vector<Ex
 | 
			
		|||
                s2 = string(s2, 0, p + 1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        es2->push_back(new ExprString(symbols.create(s2)));
 | 
			
		||||
        es2->push_back(new ExprString(symbols.Create(s2)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* If this is a single string, then don't do a concatenation. */
 | 
			
		||||
| 
						 | 
				
			
			@ -314,13 +314,13 @@ expr: expr_function;
 | 
			
		|||
 | 
			
		||||
expr_function
 | 
			
		||||
  : ID ':' expr_function
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.create($1), false, 0, $3); }
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.Create($1), false, 0, $3); }
 | 
			
		||||
  | '{' formals '}' ':' expr_function
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.create(""), true, $2, $5); }
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.Create(""), true, $2, $5); }
 | 
			
		||||
  | '{' formals '}' '@' ID ':' expr_function
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.create($5), true, $2, $7); }
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.Create($5), true, $2, $7); }
 | 
			
		||||
  | ID '@' '{' formals '}' ':' expr_function
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.create($1), true, $4, $7); }
 | 
			
		||||
    { $$ = new ExprLambda(CUR_POS, data->symbols.Create($1), true, $4, $7); }
 | 
			
		||||
  | ASSERT expr ';' expr_function
 | 
			
		||||
    { $$ = new ExprAssert(CUR_POS, $2, $4); }
 | 
			
		||||
  | WITH expr ';' expr_function
 | 
			
		||||
| 
						 | 
				
			
			@ -341,13 +341,13 @@ expr_if
 | 
			
		|||
 | 
			
		||||
expr_op
 | 
			
		||||
  : '!' expr_op %prec NOT { $$ = new ExprOpNot($2); }
 | 
			
		||||
  | '-' expr_op %prec NEGATE { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__sub")), new ExprInt(0)), $2); }
 | 
			
		||||
  | '-' expr_op %prec NEGATE { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__sub")), new ExprInt(0)), $2); }
 | 
			
		||||
  | expr_op EQ expr_op { $$ = new ExprOpEq($1, $3); }
 | 
			
		||||
  | expr_op NEQ expr_op { $$ = new ExprOpNEq($1, $3); }
 | 
			
		||||
  | expr_op '<' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $1), $3); }
 | 
			
		||||
  | expr_op LEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $3), $1)); }
 | 
			
		||||
  | expr_op '>' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $3), $1); }
 | 
			
		||||
  | expr_op GEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $1), $3)); }
 | 
			
		||||
  | expr_op '<' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__lessThan")), $1), $3); }
 | 
			
		||||
  | expr_op LEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__lessThan")), $3), $1)); }
 | 
			
		||||
  | expr_op '>' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__lessThan")), $3), $1); }
 | 
			
		||||
  | expr_op GEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__lessThan")), $1), $3)); }
 | 
			
		||||
  | expr_op AND expr_op { $$ = new ExprOpAnd(CUR_POS, $1, $3); }
 | 
			
		||||
  | expr_op OR expr_op { $$ = new ExprOpOr(CUR_POS, $1, $3); }
 | 
			
		||||
  | expr_op IMPL expr_op { $$ = new ExprOpImpl(CUR_POS, $1, $3); }
 | 
			
		||||
| 
						 | 
				
			
			@ -355,9 +355,9 @@ expr_op
 | 
			
		|||
  | expr_op '?' attrpath { $$ = new ExprOpHasAttr($1, *$3); }
 | 
			
		||||
  | expr_op '+' expr_op
 | 
			
		||||
    { $$ = new ExprConcatStrings(CUR_POS, false, new vector<Expr *>({$1, $3})); }
 | 
			
		||||
  | expr_op '-' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__sub")), $1), $3); }
 | 
			
		||||
  | expr_op '*' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__mul")), $1), $3); }
 | 
			
		||||
  | expr_op '/' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__div")), $1), $3); }
 | 
			
		||||
  | expr_op '-' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__sub")), $1), $3); }
 | 
			
		||||
  | expr_op '*' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__mul")), $1), $3); }
 | 
			
		||||
  | expr_op '/' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.Create("__div")), $1), $3); }
 | 
			
		||||
  | expr_op CONCAT expr_op { $$ = new ExprOpConcatLists(CUR_POS, $1, $3); }
 | 
			
		||||
  | expr_app
 | 
			
		||||
  ;
 | 
			
		||||
| 
						 | 
				
			
			@ -376,7 +376,7 @@ expr_select
 | 
			
		|||
  | /* Backwards compatibility: because Nixpkgs has a rarely used
 | 
			
		||||
       function named ‘or’, allow stuff like ‘map or [...]’. */
 | 
			
		||||
    expr_simple OR_KW
 | 
			
		||||
    { $$ = new ExprApp(CUR_POS, $1, new ExprVar(CUR_POS, data->symbols.create("or"))); }
 | 
			
		||||
    { $$ = new ExprApp(CUR_POS, $1, new ExprVar(CUR_POS, data->symbols.Create("or"))); }
 | 
			
		||||
  | expr_simple { $$ = $1; }
 | 
			
		||||
  ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -385,7 +385,7 @@ expr_simple
 | 
			
		|||
      if (strcmp($1, "__curPos") == 0)
 | 
			
		||||
          $$ = new ExprPos(CUR_POS);
 | 
			
		||||
      else
 | 
			
		||||
          $$ = new ExprVar(CUR_POS, data->symbols.create($1));
 | 
			
		||||
          $$ = new ExprVar(CUR_POS, data->symbols.Create($1));
 | 
			
		||||
  }
 | 
			
		||||
  | INT { $$ = new ExprInt($1); }
 | 
			
		||||
  | FLOAT { $$ = new ExprFloat($1); }
 | 
			
		||||
| 
						 | 
				
			
			@ -398,16 +398,16 @@ expr_simple
 | 
			
		|||
  | SPATH {
 | 
			
		||||
      string path($1 + 1, strlen($1) - 2);
 | 
			
		||||
      $$ = new ExprApp(CUR_POS,
 | 
			
		||||
          new ExprApp(new ExprVar(data->symbols.create("__findFile")),
 | 
			
		||||
              new ExprVar(data->symbols.create("__nixPath"))),
 | 
			
		||||
          new ExprString(data->symbols.create(path)));
 | 
			
		||||
          new ExprApp(new ExprVar(data->symbols.Create("__findFile")),
 | 
			
		||||
              new ExprVar(data->symbols.Create("__nixPath"))),
 | 
			
		||||
          new ExprString(data->symbols.Create(path)));
 | 
			
		||||
  }
 | 
			
		||||
  | URI { $$ = new ExprString(data->symbols.create($1)); }
 | 
			
		||||
  | URI { $$ = new ExprString(data->symbols.Create($1)); }
 | 
			
		||||
  | '(' expr ')' { $$ = $2; }
 | 
			
		||||
  /* Let expressions `let {..., body = ...}' are just desugared
 | 
			
		||||
     into `(rec {..., body = ...}).body'. */
 | 
			
		||||
  | LET '{' binds '}'
 | 
			
		||||
    { $3->recursive = true; $$ = new ExprSelect(noPos, $3, data->symbols.create("body")); }
 | 
			
		||||
    { $3->recursive = true; $$ = new ExprSelect(noPos, $3, data->symbols.Create("body")); }
 | 
			
		||||
  | REC '{' binds '}'
 | 
			
		||||
    { $3->recursive = true; $$ = $3; }
 | 
			
		||||
  | '{' binds '}'
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +418,7 @@ expr_simple
 | 
			
		|||
string_parts
 | 
			
		||||
  : STR
 | 
			
		||||
  | string_parts_interpolated { $$ = new ExprConcatStrings(CUR_POS, true, $1); }
 | 
			
		||||
  | { $$ = new ExprString(data->symbols.create("")); }
 | 
			
		||||
  | { $$ = new ExprString(data->symbols.Create("")); }
 | 
			
		||||
  ;
 | 
			
		||||
 | 
			
		||||
string_parts_interpolated
 | 
			
		||||
| 
						 | 
				
			
			@ -462,7 +462,7 @@ binds
 | 
			
		|||
  ;
 | 
			
		||||
 | 
			
		||||
attrs
 | 
			
		||||
  : attrs attr { $$ = $1; $1->push_back(AttrName(data->symbols.create($2))); }
 | 
			
		||||
  : attrs attr { $$ = $1; $1->push_back(AttrName(data->symbols.Create($2))); }
 | 
			
		||||
  | attrs string_attr
 | 
			
		||||
    { $$ = $1;
 | 
			
		||||
      ExprString * str = dynamic_cast<ExprString *>($2);
 | 
			
		||||
| 
						 | 
				
			
			@ -477,7 +477,7 @@ attrs
 | 
			
		|||
  ;
 | 
			
		||||
 | 
			
		||||
attrpath
 | 
			
		||||
  : attrpath '.' attr { $$ = $1; $1->push_back(AttrName(data->symbols.create($3))); }
 | 
			
		||||
  : attrpath '.' attr { $$ = $1; $1->push_back(AttrName(data->symbols.Create($3))); }
 | 
			
		||||
  | attrpath '.' string_attr
 | 
			
		||||
    { $$ = $1;
 | 
			
		||||
      ExprString * str = dynamic_cast<ExprString *>($3);
 | 
			
		||||
| 
						 | 
				
			
			@ -487,7 +487,7 @@ attrpath
 | 
			
		|||
      } else
 | 
			
		||||
          $$->push_back(AttrName($3));
 | 
			
		||||
    }
 | 
			
		||||
  | attr { $$ = new vector<AttrName>; $$->push_back(AttrName(data->symbols.create($1))); }
 | 
			
		||||
  | attr { $$ = new vector<AttrName>; $$->push_back(AttrName(data->symbols.Create($1))); }
 | 
			
		||||
  | string_attr
 | 
			
		||||
    { $$ = new vector<AttrName>;
 | 
			
		||||
      ExprString *str = dynamic_cast<ExprString *>($1);
 | 
			
		||||
| 
						 | 
				
			
			@ -526,8 +526,8 @@ formals
 | 
			
		|||
  ;
 | 
			
		||||
 | 
			
		||||
formal
 | 
			
		||||
  : ID { $$ = new Formal(data->symbols.create($1), 0); }
 | 
			
		||||
  | ID '?' expr { $$ = new Formal(data->symbols.create($1), $3); }
 | 
			
		||||
  : ID { $$ = new Formal(data->symbols.Create($1), 0); }
 | 
			
		||||
  | ID '?' expr { $$ = new Formal(data->symbols.Create($1), $3); }
 | 
			
		||||
  ;
 | 
			
		||||
 | 
			
		||||
%%
 | 
			
		||||
| 
						 | 
				
			
			@ -552,7 +552,7 @@ Expr * EvalState::parse(const char * text,
 | 
			
		|||
    yyscan_t scanner;
 | 
			
		||||
    ParseData data(*this);
 | 
			
		||||
    data.basePath = basePath;
 | 
			
		||||
    data.path = data.symbols.create(path);
 | 
			
		||||
    data.path = data.symbols.Create(path);
 | 
			
		||||
 | 
			
		||||
    yylex_init(&scanner);
 | 
			
		||||
    yy_scan_string(text, scanner);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										49
									
								
								third_party/nix/src/libexpr/primops.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										49
									
								
								third_party/nix/src/libexpr/primops.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -118,12 +118,12 @@ static void prim_scopedImport(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
    mkString(*v2, path, {"=" + path});
 | 
			
		||||
    v2 = state.allocAttr(w, state.sName);
 | 
			
		||||
    mkString(*v2, drv.env["name"]);
 | 
			
		||||
    Value* outputsVal = state.allocAttr(w, state.symbols.create("outputs"));
 | 
			
		||||
    Value* outputsVal = state.allocAttr(w, state.symbols.Create("outputs"));
 | 
			
		||||
    state.mkList(*outputsVal, drv.outputs.size());
 | 
			
		||||
    unsigned int outputs_index = 0;
 | 
			
		||||
 | 
			
		||||
    for (const auto& o : drv.outputs) {
 | 
			
		||||
      v2 = state.allocAttr(w, state.symbols.create(o.first));
 | 
			
		||||
      v2 = state.allocAttr(w, state.symbols.Create(o.first));
 | 
			
		||||
      mkString(*v2, o.second.path, {"!" + o.first + "!" + path});
 | 
			
		||||
      outputsVal->listElems()[outputs_index] = state.allocValue();
 | 
			
		||||
      mkString(*(outputsVal->listElems()[outputs_index++]), o.first);
 | 
			
		||||
| 
						 | 
				
			
			@ -291,7 +291,7 @@ static void prim_typeOf(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
    default:
 | 
			
		||||
      abort();
 | 
			
		||||
  }
 | 
			
		||||
  mkString(v, state.symbols.create(t));
 | 
			
		||||
  mkString(v, state.symbols.Create(t));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Determine whether the argument is the null value. */
 | 
			
		||||
| 
						 | 
				
			
			@ -394,7 +394,7 @@ static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
 | 
			
		||||
  /* Get the start set. */
 | 
			
		||||
  Bindings::iterator startSet =
 | 
			
		||||
      args[0]->attrs->find(state.symbols.create("startSet"));
 | 
			
		||||
      args[0]->attrs->find(state.symbols.Create("startSet"));
 | 
			
		||||
  if (startSet == args[0]->attrs->end()) {
 | 
			
		||||
    throw EvalError(format("attribute 'startSet' required, at %1%") % pos);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -407,7 +407,7 @@ static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
 | 
			
		||||
  /* Get the operator. */
 | 
			
		||||
  Bindings::iterator op =
 | 
			
		||||
      args[0]->attrs->find(state.symbols.create("operator"));
 | 
			
		||||
      args[0]->attrs->find(state.symbols.Create("operator"));
 | 
			
		||||
  if (op == args[0]->attrs->end()) {
 | 
			
		||||
    throw EvalError(format("attribute 'operator' required, at %1%") % pos);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -426,7 +426,7 @@ static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
 | 
			
		||||
    state.forceAttrs(*e, pos);
 | 
			
		||||
 | 
			
		||||
    Bindings::iterator key = e->attrs->find(state.symbols.create("key"));
 | 
			
		||||
    Bindings::iterator key = e->attrs->find(state.symbols.Create("key"));
 | 
			
		||||
    if (key == e->attrs->end()) {
 | 
			
		||||
      throw EvalError(format("attribute 'key' required, at %1%") % pos);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -493,10 +493,10 @@ static void prim_tryEval(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  try {
 | 
			
		||||
    state.forceValue(*args[0]);
 | 
			
		||||
    v.attrs->push_back(Attr(state.sValue, args[0]));
 | 
			
		||||
    mkBool(*state.allocAttr(v, state.symbols.create("success")), true);
 | 
			
		||||
    mkBool(*state.allocAttr(v, state.symbols.Create("success")), true);
 | 
			
		||||
  } catch (AssertionError& e) {
 | 
			
		||||
    mkBool(*state.allocAttr(v, state.sValue), false);
 | 
			
		||||
    mkBool(*state.allocAttr(v, state.symbols.create("success")), false);
 | 
			
		||||
    mkBool(*state.allocAttr(v, state.symbols.Create("success")), false);
 | 
			
		||||
  }
 | 
			
		||||
  v.attrs->sort();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -846,7 +846,7 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
 | 
			
		|||
  state.mkAttrs(v, 1 + drv.outputs.size());
 | 
			
		||||
  mkString(*state.allocAttr(v, state.sDrvPath), drvPath, {"=" + drvPath});
 | 
			
		||||
  for (auto& i : drv.outputs) {
 | 
			
		||||
    mkString(*state.allocAttr(v, state.symbols.create(i.first)), i.second.path,
 | 
			
		||||
    mkString(*state.allocAttr(v, state.symbols.Create(i.first)), i.second.path,
 | 
			
		||||
             {"!" + i.first + "!" + drvPath});
 | 
			
		||||
  }
 | 
			
		||||
  v.attrs->sort();
 | 
			
		||||
| 
						 | 
				
			
			@ -987,12 +987,12 @@ static void prim_findFile(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
    state.forceAttrs(v2, pos);
 | 
			
		||||
 | 
			
		||||
    string prefix;
 | 
			
		||||
    Bindings::iterator i = v2.attrs->find(state.symbols.create("prefix"));
 | 
			
		||||
    Bindings::iterator i = v2.attrs->find(state.symbols.Create("prefix"));
 | 
			
		||||
    if (i != v2.attrs->end()) {
 | 
			
		||||
      prefix = state.forceStringNoCtx(*i->value, pos);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    i = v2.attrs->find(state.symbols.create("path"));
 | 
			
		||||
    i = v2.attrs->find(state.symbols.Create("path"));
 | 
			
		||||
    if (i == v2.attrs->end()) {
 | 
			
		||||
      throw EvalError(format("attribute 'path' missing, at %1%") % pos);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1050,7 +1050,7 @@ static void prim_readDir(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  state.mkAttrs(v, entries.size());
 | 
			
		||||
 | 
			
		||||
  for (auto& ent : entries) {
 | 
			
		||||
    Value* ent_val = state.allocAttr(v, state.symbols.create(ent.name));
 | 
			
		||||
    Value* ent_val = state.allocAttr(v, state.symbols.Create(ent.name));
 | 
			
		||||
    if (ent.type == DT_UNKNOWN) {
 | 
			
		||||
      ent.type = getFileType(path + "/" + ent.name);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1301,7 +1301,7 @@ void prim_getAttr(EvalState& state, const Pos& pos, Value** args, Value& v) {
 | 
			
		|||
  string attr = state.forceStringNoCtx(*args[0], pos);
 | 
			
		||||
  state.forceAttrs(*args[1], pos);
 | 
			
		||||
  // !!! Should we create a symbol here or just do a lookup?
 | 
			
		||||
  Bindings::iterator i = args[1]->attrs->find(state.symbols.create(attr));
 | 
			
		||||
  Bindings::iterator i = args[1]->attrs->find(state.symbols.Create(attr));
 | 
			
		||||
  if (i == args[1]->attrs->end()) {
 | 
			
		||||
    throw EvalError(format("attribute '%1%' missing, at %2%") % attr % pos);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -1318,7 +1318,7 @@ void prim_unsafeGetAttrPos(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
                           Value& v) {
 | 
			
		||||
  string attr = state.forceStringNoCtx(*args[0], pos);
 | 
			
		||||
  state.forceAttrs(*args[1], pos);
 | 
			
		||||
  Bindings::iterator i = args[1]->attrs->find(state.symbols.create(attr));
 | 
			
		||||
  Bindings::iterator i = args[1]->attrs->find(state.symbols.Create(attr));
 | 
			
		||||
  if (i == args[1]->attrs->end()) {
 | 
			
		||||
    mkNull(v);
 | 
			
		||||
  } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -1331,7 +1331,7 @@ static void prim_hasAttr(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
                         Value& v) {
 | 
			
		||||
  string attr = state.forceStringNoCtx(*args[0], pos);
 | 
			
		||||
  state.forceAttrs(*args[1], pos);
 | 
			
		||||
  mkBool(v, args[1]->attrs->find(state.symbols.create(attr)) !=
 | 
			
		||||
  mkBool(v, args[1]->attrs->find(state.symbols.Create(attr)) !=
 | 
			
		||||
                args[1]->attrs->end());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1351,7 +1351,7 @@ static void prim_removeAttrs(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  std::set<Symbol> names;
 | 
			
		||||
  for (unsigned int i = 0; i < args[1]->listSize(); ++i) {
 | 
			
		||||
    state.forceStringNoCtx(*args[1]->listElems()[i], pos);
 | 
			
		||||
    names.insert(state.symbols.create(args[1]->listElems()[i]->string.s));
 | 
			
		||||
    names.insert(state.symbols.Create(args[1]->listElems()[i]->string.s));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* Copy all attributes not in that set.  Note that we don't need
 | 
			
		||||
| 
						 | 
				
			
			@ -1391,10 +1391,13 @@ static void prim_listToAttrs(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
    }
 | 
			
		||||
    string name = state.forceStringNoCtx(*j->value, pos);
 | 
			
		||||
 | 
			
		||||
    Symbol sym = state.symbols.create(name);
 | 
			
		||||
    Symbol sym = state.symbols.Create(name);
 | 
			
		||||
    if (seen.find(sym) == seen.end()) {
 | 
			
		||||
      Bindings::iterator j2 =
 | 
			
		||||
          v2.attrs->find(state.symbols.create(state.sValue));
 | 
			
		||||
          // TODO(tazjin): this line used to construct the symbol again:
 | 
			
		||||
          // state.symbols.Create(state.sValue));
 | 
			
		||||
          // Why?
 | 
			
		||||
          v2.attrs->find(state.sValue);
 | 
			
		||||
      if (j2 == v2.attrs->end()) {
 | 
			
		||||
        throw TypeError(format("'value' attribute missing in a call to "
 | 
			
		||||
                               "'listToAttrs', at %1%") %
 | 
			
		||||
| 
						 | 
				
			
			@ -1436,7 +1439,7 @@ static void prim_intersectAttrs(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
*/
 | 
			
		||||
static void prim_catAttrs(EvalState& state, const Pos& pos, Value** args,
 | 
			
		||||
                          Value& v) {
 | 
			
		||||
  Symbol attrName = state.symbols.create(state.forceStringNoCtx(*args[0], pos));
 | 
			
		||||
  Symbol attrName = state.symbols.Create(state.forceStringNoCtx(*args[0], pos));
 | 
			
		||||
  state.forceList(*args[1], pos);
 | 
			
		||||
 | 
			
		||||
  Value* res[args[1]->listSize()];
 | 
			
		||||
| 
						 | 
				
			
			@ -2144,7 +2147,7 @@ static void prim_parseDrvName(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  DrvName parsed(name);
 | 
			
		||||
  state.mkAttrs(v, 2);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.sName), parsed.name);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("version")),
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("version")),
 | 
			
		||||
           parsed.version);
 | 
			
		||||
  v.attrs->sort();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2430,7 +2433,7 @@ void EvalState::createBaseEnv() {
 | 
			
		|||
     `drvPath' and `outPath' attributes lazily. */
 | 
			
		||||
  string path =
 | 
			
		||||
      canonPath(settings.nixDataDir + "/nix/corepkgs/derivation.nix", true);
 | 
			
		||||
  sDerivationNix = symbols.create(path);
 | 
			
		||||
  sDerivationNix = symbols.Create(path);
 | 
			
		||||
  evalFile(path, v);
 | 
			
		||||
  addConstant("derivation", v);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2440,8 +2443,8 @@ void EvalState::createBaseEnv() {
 | 
			
		|||
  for (auto& i : searchPath) {
 | 
			
		||||
    v2 = v.listElems()[n++] = allocValue();
 | 
			
		||||
    mkAttrs(*v2, 2);
 | 
			
		||||
    mkString(*allocAttr(*v2, symbols.create("path")), i.second);
 | 
			
		||||
    mkString(*allocAttr(*v2, symbols.create("prefix")), i.first);
 | 
			
		||||
    mkString(*allocAttr(*v2, symbols.Create("path")), i.second);
 | 
			
		||||
    mkString(*allocAttr(*v2, symbols.Create("prefix")), i.first);
 | 
			
		||||
    v2->attrs->sort();
 | 
			
		||||
  }
 | 
			
		||||
  addConstant("__nixPath", v);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								third_party/nix/src/libexpr/primops/context.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								third_party/nix/src/libexpr/primops/context.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -108,10 +108,10 @@ static void prim_getContext(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
 | 
			
		||||
  state.mkAttrs(v, contextInfos.size());
 | 
			
		||||
 | 
			
		||||
  auto sPath = state.symbols.create("path");
 | 
			
		||||
  auto sAllOutputs = state.symbols.create("allOutputs");
 | 
			
		||||
  auto sPath = state.symbols.Create("path");
 | 
			
		||||
  auto sAllOutputs = state.symbols.Create("allOutputs");
 | 
			
		||||
  for (const auto& info : contextInfos) {
 | 
			
		||||
    auto& infoVal = *state.allocAttr(v, state.symbols.create(info.first));
 | 
			
		||||
    auto& infoVal = *state.allocAttr(v, state.symbols.Create(info.first));
 | 
			
		||||
    state.mkAttrs(infoVal, 3);
 | 
			
		||||
    if (info.second.path) {
 | 
			
		||||
      mkBool(*state.allocAttr(infoVal, sPath), true);
 | 
			
		||||
| 
						 | 
				
			
			@ -145,8 +145,8 @@ static void prim_appendContext(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
 | 
			
		||||
  state.forceAttrs(*args[1], pos);
 | 
			
		||||
 | 
			
		||||
  auto sPath = state.symbols.create("path");
 | 
			
		||||
  auto sAllOutputs = state.symbols.create("allOutputs");
 | 
			
		||||
  auto sPath = state.symbols.Create("path");
 | 
			
		||||
  auto sAllOutputs = state.symbols.Create("allOutputs");
 | 
			
		||||
  for (auto& i : *args[1]->attrs) {
 | 
			
		||||
    if (!state.store->isStorePath(i.name))
 | 
			
		||||
      throw EvalError("Context key '%s' is not a store path, at %s", i.name,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -246,10 +246,10 @@ static void prim_fetchGit(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  state.mkAttrs(v, 8);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.sOutPath), gitInfo.storePath,
 | 
			
		||||
           PathSet({gitInfo.storePath}));
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("rev")), gitInfo.rev);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("shortRev")),
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("rev")), gitInfo.rev);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("shortRev")),
 | 
			
		||||
           gitInfo.shortRev);
 | 
			
		||||
  mkInt(*state.allocAttr(v, state.symbols.create("revCount")),
 | 
			
		||||
  mkInt(*state.allocAttr(v, state.symbols.Create("revCount")),
 | 
			
		||||
        gitInfo.revCount);
 | 
			
		||||
  v.attrs->sort();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -220,11 +220,11 @@ static void prim_fetchMercurial(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
  state.mkAttrs(v, 8);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.sOutPath), hgInfo.storePath,
 | 
			
		||||
           PathSet({hgInfo.storePath}));
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("branch")), hgInfo.branch);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("rev")), hgInfo.rev);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.create("shortRev")),
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("branch")), hgInfo.branch);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("rev")), hgInfo.rev);
 | 
			
		||||
  mkString(*state.allocAttr(v, state.symbols.Create("shortRev")),
 | 
			
		||||
           std::string(hgInfo.rev, 0, 12));
 | 
			
		||||
  mkInt(*state.allocAttr(v, state.symbols.create("revCount")), hgInfo.revCount);
 | 
			
		||||
  mkInt(*state.allocAttr(v, state.symbols.Create("revCount")), hgInfo.revCount);
 | 
			
		||||
  v.attrs->sort();
 | 
			
		||||
 | 
			
		||||
  if (state.allowedPaths)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ static void prim_fromTOML(EvalState& state, const Pos& pos, Value** args,
 | 
			
		|||
      state.mkAttrs(v, size);
 | 
			
		||||
 | 
			
		||||
      for (auto& i : *t2) {
 | 
			
		||||
        auto& v2 = *state.allocAttr(v, state.symbols.create(i.first));
 | 
			
		||||
        auto& v2 = *state.allocAttr(v, state.symbols.Create(i.first));
 | 
			
		||||
 | 
			
		||||
        if (auto i2 = i.second->as_table_array()) {
 | 
			
		||||
          size_t size2 = i2->get().size();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								third_party/nix/src/libexpr/value-to-json.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								third_party/nix/src/libexpr/value-to-json.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -54,7 +54,7 @@ void printValueAsJSON(EvalState& state, bool strict, Value& v,
 | 
			
		|||
          names.insert(j.name);
 | 
			
		||||
        }
 | 
			
		||||
        for (auto& j : names) {
 | 
			
		||||
          Attr& a(*v.attrs->find(state.symbols.create(j)));
 | 
			
		||||
          Attr& a(*v.attrs->find(state.symbols.Create(j)));
 | 
			
		||||
          auto placeholder(obj.placeholder(j));
 | 
			
		||||
          printValueAsJSON(state, strict, *a.value, placeholder, context);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								third_party/nix/src/libexpr/value-to-xml.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								third_party/nix/src/libexpr/value-to-xml.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -34,7 +34,7 @@ static void showAttrs(EvalState& state, bool strict, bool location,
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  for (auto& i : names) {
 | 
			
		||||
    Attr& a(*attrs.find(state.symbols.create(i)));
 | 
			
		||||
    Attr& a(*attrs.find(state.symbols.Create(i)));
 | 
			
		||||
 | 
			
		||||
    XMLAttrs xmlAttrs;
 | 
			
		||||
    xmlAttrs["name"] = i;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ static void printValueAsXML(EvalState& state, bool strict, bool location,
 | 
			
		|||
        XMLAttrs xmlAttrs;
 | 
			
		||||
 | 
			
		||||
        Bindings::iterator a =
 | 
			
		||||
            v.attrs->find(state.symbols.create("derivation"));
 | 
			
		||||
            v.attrs->find(state.symbols.Create("derivation"));
 | 
			
		||||
 | 
			
		||||
        Path drvPath;
 | 
			
		||||
        a = v.attrs->find(state.sDrvPath);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue