Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #166 from tom-tan/fix-implicit-conversion
Fix implicit conversions of dynamic array to bool
  • Loading branch information
MartinNowak committed Apr 20, 2015
2 parents 4a7f98d + b8ee224 commit 2aed015
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions catdoc.d
Expand Up @@ -25,7 +25,7 @@ Usage:

string ofile;
getopt(args, "o", &ofile);
if (!ofile)
if (!ofile.ptr)
{
writeln("catdoc: set output file with -o=filename");
return 1;
Expand Down Expand Up @@ -53,7 +53,7 @@ Usage:
if (i + 8 < input.length && std.string.icmp(input[i + 1 .. i + 8], "Macros:") == 0)
{
comment ~= input[4 .. i + 1];
if (!macros)
if (!macros.ptr)
macros = "Macros:\n";
macros ~= input[i + 8 .. $];
goto L1;
Expand Down
24 changes: 12 additions & 12 deletions rdmd.d
Expand Up @@ -76,7 +76,7 @@ int main(string[] args)
else if (value[0] == 'd')
{
// -odmydir passed
if (!exe) // Don't let -od override -of
if (!exe.ptr) // Don't let -od override -of
{
// add a trailing dir separator to clarify it's a dir
exe = value[1 .. $];
Expand Down Expand Up @@ -148,7 +148,7 @@ int main(string[] args)
* To see the full discussion please refer to:
* https://github.com/D-Programming-Language/tools/pull/122
*/
if ((makeDepend || makeDepFile) && (!exe || exe.endsWith(dirSeparator)))
if ((makeDepend || makeDepFile.ptr) && (!exe.ptr || exe.endsWith(dirSeparator)))
{
stderr.write(helpString);
stderr.writeln();
Expand All @@ -164,8 +164,8 @@ int main(string[] args)
string root;
string[] programArgs;
// Just evaluate this program!
enforce(!(loop && eval), "Cannot mix --eval and --loop.");
if (loop)
enforce(!(loop.ptr && eval.ptr), "Cannot mix --eval and --loop.");
if (loop.ptr)
{
enforce(programPos == args.length, "Cannot have both --loop and a " ~
"program file ('" ~ args[programPos] ~ "').");
Expand All @@ -174,7 +174,7 @@ int main(string[] args)
~ std.string.join(loop, "\n")
~ ";\n} }");
}
else if (eval)
else if (eval.ptr)
{
enforce(programPos == args.length, "Cannot have both --eval and a " ~
"program file ('" ~ args[programPos] ~ "').");
Expand Down Expand Up @@ -203,10 +203,10 @@ int main(string[] args)
string outExt = lib ? libExt : binExt;

// --build-only implies the user would like a binary in the program's directory
if (buildOnly && !exe)
if (buildOnly && !exe.ptr)
exe = exeDirname ~ dirSeparator;

if (exe && exe.endsWith(dirSeparator))
if (exe.ptr && exe.endsWith(dirSeparator))
{
// user specified a directory, complete it to a file
exe = buildPath(exe, exeBasename) ~ outExt;
Expand Down Expand Up @@ -263,7 +263,7 @@ int main(string[] args)
*/
string buildWitness;
SysTime lastBuildTime = SysTime.min;
if (exe)
if (exe.ptr)
{
// user-specified exe name
buildWitness = buildPath(workDir, ".built");
Expand Down Expand Up @@ -395,7 +395,7 @@ private @property string myOwnTmpDir()
private string getWorkPath(in string root, in string[] compilerFlags)
{
static string workPath;
if (workPath)
if (workPath.ptr)
return workPath;

enum string[] irrelevantSwitches = [
Expand Down Expand Up @@ -547,7 +547,7 @@ private int run(string[] args, string output = null, bool replace = false)
yap(replace ? "exec " : "spawn ", args.text);
if (dryRun) return 0;

if (replace && !output)
if (replace && !output.ptr)
{
version (Windows)
{ /* Windows doesn't have exec, fall back to spawnProcess+wait */ }
Expand All @@ -560,7 +560,7 @@ private int run(string[] args, string output = null, bool replace = false)
}

File outputFile;
if (output)
if (output.ptr)
outputFile = File(output, "wb");
else
outputFile = stdout;
Expand Down Expand Up @@ -657,7 +657,7 @@ private string[string] getDependencies(string rootModule, string workDir,
case "library":
immutable libName = captures[2].strip();
immutable libPath = findLib(libName);
if (libPath)
if (libPath.ptr)
{
yap("library ", libName, " ", libPath);
result[libPath] = null;
Expand Down

0 comments on commit 2aed015

Please sign in to comment.