diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-24T21·29+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-24T21·29+0100 |
commit | 838f86b0fd880b26539664140f04e5d16669dad8 (patch) | |
tree | c8fee2f0c136fbe5bb0735604e2f04d5b02698ba /third_party/nix/src/libexpr/nixexpr.hh | |
parent | f30b2e610d9e612504a9f6460e0cc83413b80aeb (diff) |
style(3p/nix): Remove 'using std::*' from types.hh r/840
It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes.
Diffstat (limited to 'third_party/nix/src/libexpr/nixexpr.hh')
-rw-r--r-- | third_party/nix/src/libexpr/nixexpr.hh | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/third_party/nix/src/libexpr/nixexpr.hh b/third_party/nix/src/libexpr/nixexpr.hh index 3ac651c94548..8817fbc9ddb8 100644 --- a/third_party/nix/src/libexpr/nixexpr.hh +++ b/third_party/nix/src/libexpr/nixexpr.hh @@ -8,15 +8,18 @@ namespace nix { -MakeError(EvalError, Error) MakeError(ParseError, Error) - MakeError(AssertionError, EvalError) MakeError(ThrownError, AssertionError) - MakeError(Abort, EvalError) MakeError(TypeError, EvalError) - MakeError(UndefinedVarError, Error) - MakeError(RestrictedPathError, Error) - - /* Position objects. */ - - struct Pos { +MakeError(EvalError, Error); +MakeError(ParseError, Error); +MakeError(AssertionError, EvalError); +MakeError(ThrownError, AssertionError); +MakeError(Abort, EvalError); +MakeError(TypeError, EvalError); +MakeError(UndefinedVarError, Error); +MakeError(RestrictedPathError, Error); + +/* Position objects. */ + +struct Pos { Symbol file; unsigned int line, column; Pos() : line(0), column(0){}; @@ -30,7 +33,7 @@ MakeError(EvalError, Error) MakeError(ParseError, Error) if (!p2.line) { return false; } - int d = ((string)file).compare((string)p2.file); + int d = ((std::string)file).compare((std::string)p2.file); if (d < 0) { return true; } @@ -66,7 +69,7 @@ struct AttrName { typedef std::vector<AttrName> AttrPath; -string showAttrPath(const AttrPath& attrPath); +std::string showAttrPath(const AttrPath& attrPath); /* Abstract syntax of Nix expressions. */ @@ -297,16 +300,20 @@ struct ExprOpNot : Expr { void eval(EvalState& state, Env& env, Value& v); \ }; -MakeBinOp(ExprApp, "") MakeBinOp(ExprOpEq, "==") MakeBinOp(ExprOpNEq, "!=") - MakeBinOp(ExprOpAnd, "&&") MakeBinOp(ExprOpOr, "||") - MakeBinOp(ExprOpImpl, "->") MakeBinOp(ExprOpUpdate, "//") - MakeBinOp(ExprOpConcatLists, "++") +MakeBinOp(ExprApp, ""); +MakeBinOp(ExprOpEq, "=="); +MakeBinOp(ExprOpNEq, "!="); +MakeBinOp(ExprOpAnd, "&&"); +MakeBinOp(ExprOpOr, "||"); +MakeBinOp(ExprOpImpl, "->"); +MakeBinOp(ExprOpUpdate, "//"); +MakeBinOp(ExprOpConcatLists, "++"); - struct ExprConcatStrings : Expr { +struct ExprConcatStrings : Expr { Pos pos; bool forceString; - vector<Expr*>* es; - ExprConcatStrings(const Pos& pos, bool forceString, vector<Expr*>* es) + std::vector<Expr*>* es; + ExprConcatStrings(const Pos& pos, bool forceString, std::vector<Expr*>* es) : pos(pos), forceString(forceString), es(es){}; COMMON_METHODS }; |