@@ -191,7 +191,7 @@ std::ostream & operator<<(std::ostream & os, const ValueType t);
191191
192192struct RegexCache ;
193193
194- std::shared_ptr <RegexCache> makeRegexCache ();
194+ ref <RegexCache> makeRegexCache ();
195195
196196struct DebugTrace
197197{
@@ -372,6 +372,7 @@ public:
372372
373373 const fetchers::Settings & fetchSettings;
374374 const EvalSettings & settings;
375+
375376 SymbolTable symbols;
376377 PosTable positions;
377378
@@ -418,7 +419,7 @@ public:
418419
419420 RootValue vImportedDrvToDerivation = nullptr ;
420421
421- ref<fetchers::InputCache> inputCache;
422+ const ref<fetchers::InputCache> inputCache;
422423
423424 /* *
424425 * Debugger
@@ -471,18 +472,18 @@ private:
471472
472473 /* Cache for calls to addToStore(); maps source paths to the store
473474 paths. */
474- ref<boost::concurrent_flat_map<SourcePath, StorePath>> srcToStore;
475+ const ref<boost::concurrent_flat_map<SourcePath, StorePath>> srcToStore;
475476
476477 /* *
477478 * A cache that maps paths to "resolved" paths for importing Nix
478479 * expressions, i.e. `/foo` to `/foo/default.nix`.
479480 */
480- ref<boost::concurrent_flat_map<SourcePath, SourcePath>> importResolutionCache;
481+ const ref<boost::concurrent_flat_map<SourcePath, SourcePath>> importResolutionCache;
481482
482483 /* *
483484 * A cache from resolved paths to values.
484485 */
485- ref<boost::concurrent_flat_map<
486+ const ref<boost::concurrent_flat_map<
486487 SourcePath,
487488 Value *,
488489 std::hash<SourcePath>,
@@ -504,7 +505,7 @@ private:
504505 /* *
505506 * Cache used by prim_match().
506507 */
507- std::shared_ptr <RegexCache> regexCache;
508+ const ref <RegexCache> regexCache;
508509
509510public:
510511
@@ -592,12 +593,13 @@ public:
592593 * Parse a Nix expression from the specified file.
593594 */
594595 Expr * parseExprFromFile (const SourcePath & path);
595- Expr * parseExprFromFile (const SourcePath & path, std::shared_ptr<StaticEnv> & staticEnv);
596+ Expr * parseExprFromFile (const SourcePath & path, const std::shared_ptr<StaticEnv> & staticEnv);
596597
597598 /* *
598599 * Parse a Nix expression from the specified string.
599600 */
600- Expr * parseExprFromString (std::string s, const SourcePath & basePath, std::shared_ptr<StaticEnv> & staticEnv);
601+ Expr *
602+ parseExprFromString (std::string s, const SourcePath & basePath, const std::shared_ptr<StaticEnv> & staticEnv);
601603 Expr * parseExprFromString (std::string s, const SourcePath & basePath);
602604
603605 Expr * parseStdin ();
@@ -766,7 +768,7 @@ public:
766768
767769#if NIX_USE_BOEHMGC
768770 /* * A GC root for the baseEnv reference. */
769- std::shared_ptr<Env *> baseEnvP;
771+ const std::shared_ptr<Env *> baseEnvP;
770772#endif
771773
772774public:
@@ -780,7 +782,7 @@ public:
780782 /* *
781783 * The same, but used during parsing to resolve variables.
782784 */
783- std::shared_ptr<StaticEnv> staticBaseEnv; // !!! should be private
785+ const std::shared_ptr<StaticEnv> staticBaseEnv; // !!! should be private
784786
785787 /* *
786788 * Internal primops not exposed to the user.
@@ -862,7 +864,7 @@ private:
862864 size_t length,
863865 Pos::Origin origin,
864866 const SourcePath & basePath,
865- std::shared_ptr<StaticEnv> & staticEnv);
867+ const std::shared_ptr<StaticEnv> & staticEnv);
866868
867869 /* *
868870 * Current Nix call stack depth, used with `max-call-depth` setting to throw stack overflow hopefully before we run
0 commit comments