mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Fix allman brace style (#20885)
This commit is contained in:
parent
ef47ecf0a2
commit
4d4d09ab33
23 changed files with 126 additions and 79 deletions
|
@ -274,8 +274,10 @@ void disassemble(uint c) @trusted
|
|||
uint ins = *(cast(uint*)&code[c]);
|
||||
p0[0]='\0';
|
||||
|
||||
if (bObjectcode) {
|
||||
for (i=siz; i; --i) {
|
||||
if (bObjectcode)
|
||||
{
|
||||
for (i=siz; i; --i)
|
||||
{
|
||||
snprintf( buf.ptr, buf.length, "%02X", code[c+i-1] );
|
||||
printf("%s ", buf.ptr);
|
||||
//strcat( p0.ptr, buf.ptr );
|
||||
|
|
|
@ -53,7 +53,7 @@ alias nlist = dmd.backend.mach.nlist; // avoid conflict with dmd.backend.dlist
|
|||
* put before nothrow because qsort was not marked nothrow until version 2.086
|
||||
*/
|
||||
|
||||
extern (C) {
|
||||
extern (C)
|
||||
@trusted
|
||||
private int mach_rel_fp(scope const(void*) e1, scope const(void*) e2)
|
||||
{ Relocation* r1 = cast(Relocation*)e1;
|
||||
|
@ -61,7 +61,6 @@ private int mach_rel_fp(scope const(void*) e1, scope const(void*) e2)
|
|||
|
||||
return cast(int)(r1.offset - r2.offset);
|
||||
}
|
||||
}
|
||||
|
||||
@trusted
|
||||
void mach_relsort(OutBuffer* buf)
|
||||
|
|
|
@ -2133,7 +2133,7 @@ void MsCoffObj_addrel(segidx_t seg, targ_size_t offset, Symbol* targsym,
|
|||
* Sort the relocation entry buffer.
|
||||
*/
|
||||
|
||||
extern (C) {
|
||||
extern (C)
|
||||
@trusted
|
||||
private int mscoff_rel_fp(scope const(void*) e1, scope const(void*) e2)
|
||||
{ Relocation* r1 = cast(Relocation*)e1;
|
||||
|
@ -2141,7 +2141,6 @@ private int mscoff_rel_fp(scope const(void*) e1, scope const(void*) e2)
|
|||
|
||||
return cast(int)(r1.offset - r2.offset);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* Refer to address that is in the data segment.
|
||||
|
|
|
@ -651,7 +651,8 @@ char* getEAimpl(ubyte rex, uint c, int do_xmm, uint vlen)
|
|||
return displacementFixup(c + 2, 2, rmstr[rm]);
|
||||
|
||||
case 3:
|
||||
switch (opcode) {
|
||||
switch (opcode)
|
||||
{
|
||||
case 0x8c:
|
||||
case 0x8e:
|
||||
p = wordreg[rm];
|
||||
|
@ -1886,8 +1887,10 @@ void disassemble(uint c)
|
|||
p0[0]='\0';
|
||||
if (opcode == 0 && c + 1 >= code.length)
|
||||
return;
|
||||
if (bObjectcode) {
|
||||
for (i=0; i<siz; i++) {
|
||||
if (bObjectcode)
|
||||
{
|
||||
for (i=0; i<siz; i++)
|
||||
{
|
||||
snprintf( buf.ptr, buf.length, "%02X ", code[c+i] );
|
||||
strcat( p0.ptr, buf.ptr );
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ struct IdentifierCharLookup
|
|||
// Awful solution to require these lambdas.
|
||||
// However without them the extern(C++) ABI issues crop up for isInRange,
|
||||
// and then it can't access the tables.
|
||||
final switch(table) {
|
||||
final switch(table)
|
||||
{
|
||||
case IdentifierTable.UAX31:
|
||||
return IdentifierCharLookup(
|
||||
(c) => isInRange!UAX31_Start(c),
|
||||
|
|
|
@ -1989,13 +1989,15 @@ public:
|
|||
Declaration decl = ve.var;
|
||||
|
||||
// We cannot take the address of an imported symbol at compile time
|
||||
if (decl.isImportedSymbol()) {
|
||||
if (decl.isImportedSymbol())
|
||||
{
|
||||
error(e.loc, "cannot take address of imported symbol `%s` at compile time", decl.toChars());
|
||||
result = CTFEExp.cantexp;
|
||||
return;
|
||||
}
|
||||
|
||||
if (decl.isDataseg()) {
|
||||
if (decl.isDataseg())
|
||||
{
|
||||
// Normally this is already done by optimize()
|
||||
// Do it here in case optimize(WANTvalue) wasn't run before CTFE
|
||||
emplaceExp!(SymOffExp)(pue, e.loc, e.e1.isVarExp().var, 0);
|
||||
|
|
|
@ -2061,9 +2061,9 @@ string toLowercase(string s) pure @safe
|
|||
// TODO: maybe unicode lowercase, somehow
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
{
|
||||
if (!lower.length) {
|
||||
if (!lower.length)
|
||||
lower.reserve(s.length);
|
||||
}
|
||||
|
||||
lower ~= s[lower.length..i];
|
||||
c += 'a' - 'A';
|
||||
lower ~= c;
|
||||
|
|
|
@ -5343,7 +5343,8 @@ void aliasSemantic(AliasDeclaration ds, Scope* sc)
|
|||
{
|
||||
s = tident.toDsymbol(sc);
|
||||
// don't error for `var1.static_symbol`
|
||||
if (s && s.needThis()) {
|
||||
if (s && s.needThis())
|
||||
{
|
||||
error(ds.loc, "cannot alias %s member `%s` of variable `%s`",
|
||||
s.kind(), s.toChars(), mt.ident.toChars());
|
||||
errorSupplemental(ds.loc, "Use `typeof(%s)` instead to preserve behaviour",
|
||||
|
|
|
@ -976,7 +976,8 @@ public:
|
|||
{
|
||||
EnumKind kind = getEnumKind(type);
|
||||
|
||||
if (vd.visibility.kind == AST.Visibility.Kind.none || vd.visibility.kind == AST.Visibility.Kind.private_) {
|
||||
if (vd.visibility.kind == AST.Visibility.Kind.none || vd.visibility.kind == AST.Visibility.Kind.private_)
|
||||
{
|
||||
ignored("enum `%s` because it is `%s`.", vd.toPrettyChars(), AST.visibilityToChars(vd.visibility.kind));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -6908,7 +6908,8 @@ elem* buildRangeError(ref IRState irs, Loc loc)
|
|||
* Returns:
|
||||
* elem generated
|
||||
*/
|
||||
elem* buildArraySliceError(ref IRState irs, Loc loc, elem* lower, elem* upper, elem* length) {
|
||||
elem* buildArraySliceError(ref IRState irs, Loc loc, elem* lower, elem* upper, elem* length)
|
||||
{
|
||||
final switch (irs.params.checkAction)
|
||||
{
|
||||
case CHECKACTION.C:
|
||||
|
@ -6935,7 +6936,8 @@ elem* buildArraySliceError(ref IRState irs, Loc loc, elem* lower, elem* upper, e
|
|||
* Returns:
|
||||
* elem generated
|
||||
*/
|
||||
elem* buildArrayIndexError(ref IRState irs, Loc loc, elem* index, elem* length) {
|
||||
elem* buildArrayIndexError(ref IRState irs, Loc loc, elem* index, elem* length)
|
||||
{
|
||||
final switch (irs.params.checkAction)
|
||||
{
|
||||
case CHECKACTION.C:
|
||||
|
@ -6951,7 +6953,8 @@ elem* buildArrayIndexError(ref IRState irs, Loc loc, elem* index, elem* length)
|
|||
}
|
||||
|
||||
/// Returns: elem representing a C-string (char*) to the filename
|
||||
elem* locToFileElem(const ref IRState irs, Loc loc) {
|
||||
elem* locToFileElem(const ref IRState irs, Loc loc)
|
||||
{
|
||||
elem* efile;
|
||||
|
||||
if (auto fname = loc.filename)
|
||||
|
|
|
@ -101,8 +101,10 @@ private struct PathCache
|
|||
*/
|
||||
bool exists = true;
|
||||
auto st = PathStack(filespec);
|
||||
while (st.up) {
|
||||
if (auto cached = pathStatus.lookup(st.cur)) {
|
||||
while (st.up)
|
||||
{
|
||||
if (auto cached = pathStatus.lookup(st.cur))
|
||||
{
|
||||
exists = cached.value;
|
||||
break;
|
||||
}
|
||||
|
@ -112,7 +114,8 @@ private struct PathCache
|
|||
* Once a directory is found to not exist, all the directories
|
||||
* to the right of it do not exist
|
||||
*/
|
||||
while (st.down) {
|
||||
while (st.down)
|
||||
{
|
||||
if (!exists)
|
||||
pathStatus.insert(st.cur, false);
|
||||
else
|
||||
|
@ -218,17 +221,19 @@ nothrow:
|
|||
|
||||
const(char)[] n = FileName.combine(p, sdi);
|
||||
|
||||
if (!pathCache.pathExists(n)) {
|
||||
if (!pathCache.pathExists(n))
|
||||
{
|
||||
FileName.free(n.ptr);
|
||||
continue; // no need to check for anything else.
|
||||
}
|
||||
if (FileName.exists(n) == 1) {
|
||||
if (FileName.exists(n) == 1)
|
||||
return n;
|
||||
}
|
||||
|
||||
FileName.free(n.ptr);
|
||||
|
||||
n = FileName.combine(p, sd);
|
||||
if (FileName.exists(n) == 1) {
|
||||
if (FileName.exists(n) == 1)
|
||||
{
|
||||
whichPathFoundThis = pathIndex;
|
||||
return n;
|
||||
}
|
||||
|
@ -241,14 +246,16 @@ nothrow:
|
|||
if (pathCache.isExistingPath(n))
|
||||
{
|
||||
const n2i = FileName.combine(n, package_di);
|
||||
if (FileName.exists(n2i) == 1) {
|
||||
if (FileName.exists(n2i) == 1)
|
||||
{
|
||||
whichPathFoundThis = pathIndex;
|
||||
return n2i;
|
||||
}
|
||||
|
||||
FileName.free(n2i.ptr);
|
||||
const n2 = FileName.combine(n, package_d);
|
||||
if (FileName.exists(n2) == 1) {
|
||||
if (FileName.exists(n2) == 1)
|
||||
{
|
||||
whichPathFoundThis = pathIndex;
|
||||
return n2;
|
||||
}
|
||||
|
@ -272,14 +279,16 @@ nothrow:
|
|||
const p = entry.path.toDString();
|
||||
|
||||
const(char)[] n = FileName.combine(p, si);
|
||||
if (FileName.exists(n) == 1) {
|
||||
if (FileName.exists(n) == 1)
|
||||
{
|
||||
whichPathFoundThis = pathIndex;
|
||||
return n;
|
||||
}
|
||||
FileName.free(n.ptr);
|
||||
|
||||
n = FileName.combine(p, sc);
|
||||
if (FileName.exists(n) == 1) {
|
||||
if (FileName.exists(n) == 1)
|
||||
{
|
||||
whichPathFoundThis = pathIndex;
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,13 @@ import dmd.root.string;
|
|||
import dmd.target;
|
||||
import dmd.visitor;
|
||||
|
||||
version(Windows) {
|
||||
version(Windows)
|
||||
{
|
||||
extern (C) char* _getcwd(char* buffer, size_t maxlen);
|
||||
alias getcwd = _getcwd;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
import core.sys.posix.unistd : getcwd;
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,8 @@ public:
|
|||
visitType(p.type);
|
||||
}
|
||||
|
||||
override void visit(StructLiteralExp e) {
|
||||
override void visit(StructLiteralExp e)
|
||||
{
|
||||
static if (LOG)
|
||||
printf("StructLiteralExp: %s\n", e.toChars);
|
||||
|
||||
|
|
|
@ -3441,9 +3441,8 @@ class Lexer
|
|||
int linestart = 0;
|
||||
if (ct == '/')
|
||||
{
|
||||
if (q < qend && *q == ' ') {
|
||||
if (q < qend && *q == ' ')
|
||||
++q;
|
||||
}
|
||||
}
|
||||
else if (q < qend)
|
||||
{
|
||||
|
|
|
@ -1064,18 +1064,21 @@ public int runPreprocessor(Loc loc, const(char)[] cpp, const(char)[] filename, c
|
|||
if (!vsopt.VSInstallDir)
|
||||
vsopt.initialize();
|
||||
|
||||
if (auto vcincludedir = vsopt.getVCIncludeDir()) {
|
||||
if (auto vcincludedir = vsopt.getVCIncludeDir())
|
||||
includePaths.push(vcincludedir);
|
||||
} else {
|
||||
else
|
||||
return STATUS_FAILED;
|
||||
}
|
||||
if (auto sdkincludedir = vsopt.getSDKIncludePath()) {
|
||||
|
||||
if (auto sdkincludedir = vsopt.getSDKIncludePath())
|
||||
{
|
||||
includePaths.push(FileName.combine(sdkincludedir, "ucrt"));
|
||||
includePaths.push(FileName.combine(sdkincludedir, "shared"));
|
||||
includePaths.push(FileName.combine(sdkincludedir, "um"));
|
||||
includePaths.push(FileName.combine(sdkincludedir, "winrt"));
|
||||
includePaths.push(FileName.combine(sdkincludedir, "cppwinrt"));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
includePaths = Strings.init;
|
||||
return STATUS_FAILED;
|
||||
}
|
||||
|
@ -1193,13 +1196,15 @@ public int runPreprocessor(Loc loc, const(char)[] cpp, const(char)[] filename, c
|
|||
|
||||
// pipe so we can read the output of the preprocssor
|
||||
int[2] pipefd; // [0] is read, [1] is write
|
||||
if (pipe(&pipefd[0]) == -1) {
|
||||
if (pipe(&pipefd[0]) == -1)
|
||||
{
|
||||
perror("pipe"); // failed to create pipe
|
||||
return STATUS_FAILED;
|
||||
}
|
||||
|
||||
pid_t childpid = fork();
|
||||
if (childpid == -1) {
|
||||
if (childpid == -1)
|
||||
{
|
||||
perror("fork failed"); // fork failed
|
||||
return STATUS_FAILED;
|
||||
}
|
||||
|
@ -1223,11 +1228,11 @@ public int runPreprocessor(Loc loc, const(char)[] cpp, const(char)[] filename, c
|
|||
OutBuffer buffer;
|
||||
ubyte[1024] tmp = void;
|
||||
ptrdiff_t nread;
|
||||
while ((nread = read(pipefd[0], tmp.ptr, tmp.length)) > 0) {
|
||||
while ((nread = read(pipefd[0], tmp.ptr, tmp.length)) > 0)
|
||||
buffer.write(tmp[0 .. nread]);
|
||||
}
|
||||
|
||||
if (nread == -1) {
|
||||
if (nread == -1)
|
||||
{
|
||||
perror("read");
|
||||
return STATUS_FAILED;
|
||||
}
|
||||
|
|
|
@ -334,9 +334,8 @@ const(char)[] parse_conf_arg(Strings* args)
|
|||
const(char)[] arg = p.toDString;
|
||||
if (arg.length && arg[0] == '-')
|
||||
{
|
||||
if(arg.length >= 6 && arg[1 .. 6] == "conf="){
|
||||
if(arg.length >= 6 && arg[1 .. 6] == "conf=")
|
||||
conf = arg[6 .. $];
|
||||
}
|
||||
else if (arg[1 .. $] == "run")
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3863,7 +3863,8 @@ extern (C++) struct ParameterList
|
|||
foreach (_, p1; cast() this)
|
||||
{
|
||||
auto p2 = other[idx++];
|
||||
if (!p2 || p1 != p2) {
|
||||
if (!p2 || p1 != p2)
|
||||
{
|
||||
diff = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -341,8 +341,8 @@ unittest
|
|||
* The null-terminator is inside the bounds of the array.
|
||||
* If cp could not be resolved, null is returned.
|
||||
*/
|
||||
private char[] lookupInEnvironment(scope const(char)* cp) nothrow {
|
||||
|
||||
private char[] lookupInEnvironment(scope const(char)* cp) nothrow
|
||||
{
|
||||
import core.stdc.stdlib: getenv;
|
||||
import core.stdc.string: strlen;
|
||||
import dmd.root.rmem: mem;
|
||||
|
|
|
@ -377,9 +377,9 @@ auto splitLines(const char[] text)
|
|||
public const(char)[] front()
|
||||
{
|
||||
advance();
|
||||
if (index > eolIndex || index >= text.length) {
|
||||
if (index > eolIndex || index >= text.length)
|
||||
return "";
|
||||
}
|
||||
|
||||
return text[index .. eolIndex];
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,8 @@ longdouble_soft strtold_dm(const(char) *p, char **endp)
|
|||
pow >>= 1;
|
||||
u++;
|
||||
}
|
||||
static if(0) {
|
||||
static if(0)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
printf("%04x ",ldval.value[i]);
|
||||
printf("\n");
|
||||
|
@ -419,8 +420,8 @@ void main()
|
|||
|
||||
/************************* Bigint ************************************/
|
||||
|
||||
static if (0) {
|
||||
|
||||
static if (0)
|
||||
{
|
||||
/* This program computes powers of 10 exactly.
|
||||
* Used to generate postab[].
|
||||
*/
|
||||
|
|
|
@ -63,7 +63,8 @@ string intToString(int value) nothrow {
|
|||
}
|
||||
|
||||
/// Represents a SARIF result containing a rule ID, message, and location.
|
||||
struct SarifResult {
|
||||
struct SarifResult
|
||||
{
|
||||
string ruleId; /// Rule identifier.
|
||||
string message; /// Error or warning message.
|
||||
string uri; /// URI of the affected file.
|
||||
|
@ -74,7 +75,8 @@ struct SarifResult {
|
|||
///
|
||||
/// Returns:
|
||||
/// - A JSON string representing the SARIF result, including the rule ID, message, and location.
|
||||
string toJson() nothrow {
|
||||
string toJson() nothrow
|
||||
{
|
||||
OutBuffer buffer;
|
||||
buffer.writestring(`{"ruleId": "`);
|
||||
buffer.writestring(ruleId);
|
||||
|
@ -115,7 +117,8 @@ void addSarifDiagnostic(const SourceLoc loc, const(char)* format, va_list ap, Er
|
|||
}
|
||||
|
||||
/// Represents a SARIF report containing tool information, invocation, and results.
|
||||
struct SarifReport {
|
||||
struct SarifReport
|
||||
{
|
||||
ToolInformation tool; /// Information about the analysis tool.
|
||||
Invocation invocation; /// Execution information.
|
||||
SarifResult[] results; /// List of SARIF results (errors, warnings, etc.).
|
||||
|
@ -124,16 +127,19 @@ struct SarifReport {
|
|||
///
|
||||
/// Returns:
|
||||
/// - A JSON string representing the SARIF report, including the tool information, invocation, and results.
|
||||
string toJson() nothrow {
|
||||
string toJson() nothrow
|
||||
{
|
||||
OutBuffer buffer;
|
||||
buffer.writestring(`{"tool": `);
|
||||
buffer.writestring(tool.toJson());
|
||||
buffer.writestring(`, "invocation": `);
|
||||
buffer.writestring(invocation.toJson());
|
||||
buffer.writestring(`, "results": [`);
|
||||
if (results.length > 0) {
|
||||
if (results.length > 0)
|
||||
{
|
||||
buffer.writestring(results[0].toJson());
|
||||
foreach (result; results[1 .. $]) {
|
||||
foreach (result; results[1 .. $])
|
||||
{
|
||||
buffer.writestring(`, `);
|
||||
buffer.writestring(result.toJson());
|
||||
}
|
||||
|
@ -144,14 +150,16 @@ struct SarifReport {
|
|||
}
|
||||
|
||||
/// Represents invocation information for the analysis process.
|
||||
struct Invocation {
|
||||
struct Invocation
|
||||
{
|
||||
bool executionSuccessful; /// Whether the execution was successful.
|
||||
|
||||
/// Converts the invocation information to a JSON string.
|
||||
///
|
||||
/// Returns:
|
||||
/// - A JSON representation of the invocation status.
|
||||
string toJson() nothrow {
|
||||
string toJson() nothrow
|
||||
{
|
||||
OutBuffer buffer;
|
||||
buffer.writestring(`{"executionSuccessful": `);
|
||||
buffer.writestring(executionSuccessful ? "true" : "false");
|
||||
|
@ -170,7 +178,8 @@ Params:
|
|||
Returns:
|
||||
A formatted error message string.
|
||||
*/
|
||||
string formatErrorMessage(const(char)* format, va_list ap) nothrow {
|
||||
string formatErrorMessage(const(char)* format, va_list ap) nothrow
|
||||
{
|
||||
char[2048] buffer;
|
||||
import core.stdc.stdio : vsnprintf;
|
||||
vsnprintf(buffer.ptr, buffer.length, format, ap);
|
||||
|
@ -188,7 +197,8 @@ Returns:
|
|||
*/
|
||||
string errorKindToString(ErrorKind kind) nothrow
|
||||
{
|
||||
final switch (kind) {
|
||||
final switch (kind)
|
||||
{
|
||||
case ErrorKind.error: return "error"; // Serious problem
|
||||
case ErrorKind.warning: return "warning"; // Problem found
|
||||
case ErrorKind.deprecation: return "note"; // Minor problem, opportunity for improvement
|
||||
|
@ -220,15 +230,15 @@ void generateSarifReport(bool executionSuccessful) nothrow
|
|||
// Extract and clean the version string
|
||||
string toolVersion = global.versionString();
|
||||
// Remove 'v' prefix if it exists
|
||||
if (toolVersion.length > 0 && toolVersion[0] == 'v') {
|
||||
if (toolVersion.length > 0 && toolVersion[0] == 'v')
|
||||
toolVersion = toolVersion[1 .. $];
|
||||
}
|
||||
|
||||
// Find the first non-numeric character after the version number
|
||||
size_t length = toolVersion.length;
|
||||
const(char)* nonNumeric = strchr(toolVersion.ptr, '-');
|
||||
if (nonNumeric) {
|
||||
if (nonNumeric)
|
||||
length = cast(size_t)(nonNumeric - toolVersion.ptr);
|
||||
}
|
||||
|
||||
string cleanedVersion = toolVersion[0 .. length];
|
||||
|
||||
// Build SARIF report
|
||||
|
@ -276,7 +286,8 @@ void generateSarifReport(bool executionSuccessful) nothrow
|
|||
ob.writestringln(`"results": [`);
|
||||
ob.level += 1;
|
||||
|
||||
foreach (idx, diag; diagnostics) {
|
||||
foreach (idx, diag; diagnostics)
|
||||
{
|
||||
ob.writestringln("{");
|
||||
ob.level += 1;
|
||||
|
||||
|
@ -332,11 +343,10 @@ void generateSarifReport(bool executionSuccessful) nothrow
|
|||
|
||||
// Closing brace for each diagnostic item
|
||||
ob.level -= 1;
|
||||
if (idx < diagnostics.length - 1) {
|
||||
if (idx < diagnostics.length - 1)
|
||||
ob.writestringln("},");
|
||||
} else {
|
||||
else
|
||||
ob.writestringln("}");
|
||||
}
|
||||
}
|
||||
|
||||
// Close the run and SARIF JSON
|
||||
|
|
|
@ -351,7 +351,8 @@ bool discardValue(Expression e)
|
|||
bool seenSideEffect = false;
|
||||
foreach(expr; [tmp.e1, tmp.e2])
|
||||
{
|
||||
if (hasSideEffect(expr)) {
|
||||
if (hasSideEffect(expr))
|
||||
{
|
||||
errorSupplemental(expr.loc, "note that `%s` may have a side effect", expr.toErrMsg());
|
||||
seenSideEffect |= true;
|
||||
}
|
||||
|
|
|
@ -436,8 +436,10 @@ enum FirstCKeyword = TOK.inline;
|
|||
// Assert that all token enum members have consecutive values and
|
||||
// that none of them overlap
|
||||
static assert(() {
|
||||
foreach (idx, enumName; __traits(allMembers, TOK)) {
|
||||
static if (idx != __traits(getMember, TOK, enumName)) {
|
||||
foreach (idx, enumName; __traits(allMembers, TOK))
|
||||
{
|
||||
static if (idx != __traits(getMember, TOK, enumName))
|
||||
{
|
||||
pragma(msg, "Error: Expected TOK.", enumName, " to be ", idx, " but is ", __traits(getMember, TOK, enumName));
|
||||
static assert(0);
|
||||
}
|
||||
|
@ -925,13 +927,18 @@ nothrow:
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern(D) void appendInterpolatedPart(const ref OutBuffer buf) {
|
||||
extern(D) void appendInterpolatedPart(const ref OutBuffer buf)
|
||||
{
|
||||
appendInterpolatedPart(cast(const(char)*)buf[].ptr, buf.length);
|
||||
}
|
||||
extern(D) void appendInterpolatedPart(const(char)[] str) {
|
||||
|
||||
extern(D) void appendInterpolatedPart(const(char)[] str)
|
||||
{
|
||||
appendInterpolatedPart(str.ptr, str.length);
|
||||
}
|
||||
extern(D) void appendInterpolatedPart(const(char)* ptr, size_t length) {
|
||||
|
||||
extern(D) void appendInterpolatedPart(const(char)* ptr, size_t length)
|
||||
{
|
||||
assert(value == TOK.interpolated);
|
||||
if (interpolatedSet is null)
|
||||
interpolatedSet = new InterpolatedSet;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue