aboutsummaryrefslogtreecommitdiff
path: root/src/nix/repl.cc
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2019-10-28 21:36:34 +0100
committerzimbatm <zimbatm@zimbatm.com>2019-10-28 21:36:34 +0100
commit3774fe55fd6c96e80cc91e13fe0a231ce836ac47 (patch)
tree1923c36ab6c05268163eb788d75224e2bf8790b9 /src/nix/repl.cc
parentec448f8bb694b6f9546e49fe6a79b86ff2b2f90a (diff)
editorFor: take a pos object instead
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r--src/nix/repl.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index ed67c285f..683a117f3 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -472,22 +472,19 @@ bool NixRepl::processLine(string line)
Value v;
evalString(arg, v);
- std::string filename;
- int lineno = 0;
+ Pos pos;
if (v.type == tPath || v.type == tString) {
PathSet context;
- filename = state.coerceToString(noPos, v, context);
- lineno = 0;
+ auto filename = state.coerceToString(noPos, v, context);
+ pos.file = state.symbols.create(filename);
} else {
// assume it's a derivation
- Pos pos = findDerivationFilename(state, v, arg);
- filename = pos.file;
- lineno = pos.line;
+ pos = findDerivationFilename(state, v, arg);
}
// Open in EDITOR
- auto args = editorFor(filename, lineno);
+ auto args = editorFor(pos);
auto editor = args.front();
args.pop_front();
runProgram(editor, args);