Skip to content

Commit

Permalink
Merge pull request dlang#66 from NilsBossung/10352
Browse files Browse the repository at this point in the history
fix Issue 10352 - Regression (2.063): --eval is broken in RDMD
  • Loading branch information
AndrejMitrovic committed Jun 20, 2013
2 parents cbe7e38 + 08ef5a7 commit 01cdc33
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions rdmd.d
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,15 @@ int main(string[] args)

auto programPos = indexOfProgram(args);
assert(programPos > 0);
if (programPos == args.length)
{
write(helpString);
return 1;
}
auto
root = args[programPos].chomp(".d") ~ ".d",
exeBasename = root.baseName(".d"),
exeDirname = root.dirName,
programArgs = args[programPos + 1 .. $];
args = args[0 .. programPos];
auto argsBeforeProgram = args[0 .. programPos];

bool bailout; // bailout set by functions called in getopt if
// program should exit
string[] loop; // set by --loop
bool addStubMain;// set by --main
string[] eval; // set by --eval
bool makeDepend;
getopt(args,
getopt(argsBeforeProgram,
std.getopt.config.caseSensitive,
std.getopt.config.passThrough,
"build-only", &buildOnly,
Expand Down Expand Up @@ -158,10 +148,23 @@ int main(string[] args)
~ std.string.join(eval, "\n") ~ ";\n}");
}

assert(args.length >= 1);
auto compilerFlags = args[1 .. $];
// no code on command line => require a source file
if (programPos == args.length)
{
write(helpString);
return 1;
}

auto
root = args[programPos].chomp(".d") ~ ".d",
exeBasename = root.baseName(".d"),
exeDirname = root.dirName,
programArgs = args[programPos + 1 .. $];

assert(argsBeforeProgram.length >= 1);
auto compilerFlags = argsBeforeProgram[1 .. $];

bool lib = args.canFind("-lib");
bool lib = compilerFlags.canFind("-lib");
string outExt = lib ? libExt : binExt;

// --build-only implies the user would like a binary in the program's directory
Expand Down Expand Up @@ -701,11 +704,11 @@ module temporary;
import std.stdio, std.algorithm, std.array, std.ascii, std.base64,
std.bigint, std.bitmanip,
std.compiler, std.complex, std.concurrency, std.container, std.conv,
std.cpuid, std.cstream, std.csv,
std.datetime, std.demangle, std.encoding, std.exception,
std.cstream, std.csv,
std.datetime, std.demangle, std.digest.md, std.encoding, std.exception,
std.file,
std.format, std.functional, std.getopt, std.json,
std.math, std.mathspecial, std.md5, std.metastrings, std.mmfile,
std.math, std.mathspecial, std.metastrings, std.mmfile,
std.numeric, std.outbuffer, std.parallelism, std.path, std.process,
std.random, std.range, std.regex, std.signals, std.socket,
std.socketstream, std.stdint, std.stdio, std.stdiobase, std.stream,
Expand Down

0 comments on commit 01cdc33

Please sign in to comment.