From 838f86b0fd880b26539664140f04e5d16669dad8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 24 May 2020 22:29:21 +0100 Subject: style(3p/nix): Remove 'using std::*' from types.hh 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. --- third_party/nix/src/libexpr/nixexpr.hh | 43 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'third_party/nix/src/libexpr/nixexpr.hh') 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 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* es; - ExprConcatStrings(const Pos& pos, bool forceString, vector* es) + std::vector* es; + ExprConcatStrings(const Pos& pos, bool forceString, std::vector* es) : pos(pos), forceString(forceString), es(es){}; COMMON_METHODS }; -- cgit 1.4.1