new dmd deprecations

This commit is contained in:
Adam D. Ruppe 2019-07-08 19:25:47 -04:00
parent dc322d1d9a
commit 7c3e46d432
2 changed files with 24 additions and 24 deletions

View File

@ -393,11 +393,11 @@ string escapedVariants(Database db, in string sql, Variant[string] t) {
string fixedup; string fixedup;
int currentStart = 0; int currentStart = 0;
// FIXME: let's make ?? render as ? so we have some escaping capability // FIXME: let's make ?? render as ? so we have some escaping capability
foreach(int i, dchar c; sql) { foreach(i, dchar c; sql) {
if(c == '?') { if(c == '?') {
fixedup ~= sql[currentStart .. i]; fixedup ~= sql[currentStart .. i];
int idxStart = i + 1; int idxStart = cast(int) i + 1;
int idxLength; int idxLength;
bool isFirst = true; bool isFirst = true;
@ -420,7 +420,7 @@ string escapedVariants(Database db, in string sql, Variant[string] t) {
currentStart = idxStart + idxLength; currentStart = idxStart + idxLength;
} else { } else {
// just leave it there, it might be done on another layer // just leave it there, it might be done on another layer
currentStart = i; currentStart = cast(int) i;
} }
} }
} }
@ -438,12 +438,12 @@ string escapedVariants(Database db, in string sql, Variant[] t) {
string fixedup; string fixedup;
int currentIndex; int currentIndex;
int currentStart = 0; int currentStart = 0;
foreach(int i, dchar c; sql) { foreach(i, dchar c; sql) {
if(c == '?') { if(c == '?') {
fixedup ~= sql[currentStart .. i]; fixedup ~= sql[currentStart .. i];
int idx = -1; int idx = -1;
currentStart = i + 1; currentStart = cast(int) i + 1;
if((i + 1) < sql.length) { if((i + 1) < sql.length) {
auto n = sql[i + 1]; auto n = sql[i + 1];
if(n >= '0' && n <= '9') { if(n >= '0' && n <= '9') {

38
jsvar.d
View File

@ -1353,38 +1353,38 @@ struct var {
var ret; var ret;
final switch(v.type) { final switch(v.type) {
case JSON_TYPE.STRING: case JSONType.string:
ret = v.str; ret = v.str;
break; break;
case JSON_TYPE.UINTEGER: case JSONType.uinteger:
ret = v.uinteger; ret = v.uinteger;
break; break;
case JSON_TYPE.INTEGER: case JSONType.integer:
ret = v.integer; ret = v.integer;
break; break;
case JSON_TYPE.FLOAT: case JSONType.float_:
ret = v.floating; ret = v.floating;
break; break;
case JSON_TYPE.OBJECT: case JSONType.object:
ret = var.emptyObject; ret = var.emptyObject;
foreach(k, val; v.object) { foreach(k, val; v.object) {
ret[k] = var.fromJsonValue(val); ret[k] = var.fromJsonValue(val);
} }
break; break;
case JSON_TYPE.ARRAY: case JSONType.array:
ret = var.emptyArray; ret = var.emptyArray;
ret._payload._array.length = v.array.length; ret._payload._array.length = v.array.length;
foreach(idx, item; v.array) { foreach(idx, item; v.array) {
ret._payload._array[idx] = var.fromJsonValue(item); ret._payload._array[idx] = var.fromJsonValue(item);
} }
break; break;
case JSON_TYPE.TRUE: case JSONType.true_:
ret = true; ret = true;
break; break;
case JSON_TYPE.FALSE: case JSONType.false_:
ret = false; ret = false;
break; break;
case JSON_TYPE.NULL: case JSONType.null_:
ret = null; ret = null;
break; break;
} }
@ -1405,9 +1405,9 @@ struct var {
val = this._payload._boolean; val = this._payload._boolean;
else { else {
if(this._payload._boolean) if(this._payload._boolean)
val.type = JSON_TYPE.TRUE; val.type = JSONType.true_;
else else
val.type = JSON_TYPE.FALSE; val.type = JSONType.false_;
} }
break; break;
case Type.Object: case Type.Object:
@ -1419,9 +1419,9 @@ struct var {
} }
} else { } else {
if(_payload._object is null) { if(_payload._object is null) {
val.type = JSON_TYPE.NULL; val.type = JSONType.null_;
} else { } else {
val.type = JSON_TYPE.OBJECT; val.type = JSONType.object;
foreach(k, v; _payload._object._properties) foreach(k, v; _payload._object._properties)
val.object[k] = v.toJsonValue(); val.object[k] = v.toJsonValue();
} }
@ -1429,19 +1429,19 @@ struct var {
break; break;
case Type.String: case Type.String:
version(new_std_json) { } else { version(new_std_json) { } else {
val.type = JSON_TYPE.STRING; val.type = JSONType.string;
} }
val.str = _payload._string; val.str = _payload._string;
break; break;
case Type.Integral: case Type.Integral:
version(new_std_json) { } else { version(new_std_json) { } else {
val.type = JSON_TYPE.INTEGER; val.type = JSONType.integer;
} }
val.integer = _payload._integral; val.integer = _payload._integral;
break; break;
case Type.Floating: case Type.Floating:
version(new_std_json) { } else { version(new_std_json) { } else {
val.type = JSON_TYPE.FLOAT; val.type = JSONType.float_;
} }
val.floating = _payload._floating; val.floating = _payload._floating;
break; break;
@ -1456,7 +1456,7 @@ struct var {
version(new_std_json) { version(new_std_json) {
val = tmp; val = tmp;
} else { } else {
val.type = JSON_TYPE.ARRAY; val.type = JSONType.array;
val.array = tmp; val.array = tmp;
} }
break; break;
@ -1464,7 +1464,7 @@ struct var {
version(new_std_json) version(new_std_json)
val = null; val = null;
else else
val.type = JSON_TYPE.NULL; // ideally we would just skip it entirely... val.type = JSONType.null_; // ideally we would just skip it entirely...
break; break;
} }
return val; return val;
@ -1504,7 +1504,7 @@ class PrototypeObject {
tmp[k] = v.toJsonValue(); tmp[k] = v.toJsonValue();
val.object = tmp; val.object = tmp;
} else { } else {
val.type = JSON_TYPE.OBJECT; val.type = JSONType.object;
foreach(k, v; this._properties) foreach(k, v; this._properties)
val.object[k] = v.toJsonValue(); val.object[k] = v.toJsonValue();
} }