mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std: remove deprecated API
This commit is contained in:
parent
fe870418b1
commit
195eeed2d8
2 changed files with 2 additions and 100 deletions
|
|
@ -147,9 +147,6 @@ pub const Mutable = struct {
|
|||
};
|
||||
}
|
||||
|
||||
// TODO: remove after release of 0.11
|
||||
pub const eqZero = @compileError("use eqlZero");
|
||||
|
||||
/// Returns true if `a == 0`.
|
||||
pub fn eqlZero(self: Mutable) bool {
|
||||
return self.toConst().eqlZero();
|
||||
|
|
@ -2486,11 +2483,6 @@ pub const Const = struct {
|
|||
return order(lhs, rhs.toConst());
|
||||
}
|
||||
|
||||
// TODO: remove after release of 0.11
|
||||
pub const eqZero = @compileError("use eqlZero");
|
||||
pub const eqAbs = @compileError("use eqlAbs");
|
||||
pub const eq = @compileError("use eql");
|
||||
|
||||
/// Returns true if `a == 0`.
|
||||
pub fn eqlZero(a: Const) bool {
|
||||
var d: Limb = 0;
|
||||
|
|
@ -2835,11 +2827,6 @@ pub const Managed = struct {
|
|||
return a.toConst().order(b.toConst());
|
||||
}
|
||||
|
||||
// TODO: remove after release of 0.11
|
||||
pub const eqZero = @compileError("use eqlZero");
|
||||
pub const eqAbs = @compileError("use eqlAbs");
|
||||
pub const eq = @compileError("use eql");
|
||||
|
||||
/// Returns true if a == 0.
|
||||
pub fn eqlZero(a: Managed) bool {
|
||||
return a.toConst().eqlZero();
|
||||
|
|
|
|||
|
|
@ -1591,93 +1591,7 @@ fn renderBuiltinCall(
|
|||
const token_tags = tree.tokens.items(.tag);
|
||||
const main_tokens = tree.nodes.items(.main_token);
|
||||
|
||||
// TODO remove before release of 0.12.0
|
||||
const slice = tree.tokenSlice(builtin_token);
|
||||
const rewrite_two_param_cast = params.len == 2 and for ([_][]const u8{
|
||||
"@bitCast",
|
||||
"@errorCast",
|
||||
"@floatCast",
|
||||
"@intCast",
|
||||
"@ptrCast",
|
||||
"@intFromFloat",
|
||||
"@floatToInt",
|
||||
"@enumFromInt",
|
||||
"@intToEnum",
|
||||
"@floatFromInt",
|
||||
"@intToFloat",
|
||||
"@ptrFromInt",
|
||||
"@intToPtr",
|
||||
"@truncate",
|
||||
}) |name| {
|
||||
if (mem.eql(u8, slice, name)) break true;
|
||||
} else false;
|
||||
|
||||
if (rewrite_two_param_cast) {
|
||||
const after_last_param_token = tree.lastToken(params[1]) + 1;
|
||||
if (token_tags[after_last_param_token] != .comma) {
|
||||
// Render all on one line, no trailing comma.
|
||||
try ais.writer().writeAll("@as");
|
||||
try renderToken(r, builtin_token + 1, .none); // (
|
||||
try renderExpression(r, params[0], .comma_space);
|
||||
} else {
|
||||
// Render one param per line.
|
||||
try ais.writer().writeAll("@as");
|
||||
ais.pushIndent();
|
||||
try renderToken(r, builtin_token + 1, .newline); // (
|
||||
try renderExpression(r, params[0], .comma);
|
||||
}
|
||||
}
|
||||
// Corresponding logic below builtin name rewrite below
|
||||
|
||||
// TODO remove before release of 0.11.0
|
||||
if (mem.eql(u8, slice, "@maximum")) {
|
||||
try ais.writer().writeAll("@max");
|
||||
} else if (mem.eql(u8, slice, "@minimum")) {
|
||||
try ais.writer().writeAll("@min");
|
||||
}
|
||||
// TODO remove before release of 0.12.0
|
||||
else if (mem.eql(u8, slice, "@boolToInt")) {
|
||||
try ais.writer().writeAll("@intFromBool");
|
||||
} else if (mem.eql(u8, slice, "@enumToInt")) {
|
||||
try ais.writer().writeAll("@intFromEnum");
|
||||
} else if (mem.eql(u8, slice, "@errorToInt")) {
|
||||
try ais.writer().writeAll("@intFromError");
|
||||
} else if (mem.eql(u8, slice, "@floatToInt")) {
|
||||
try ais.writer().writeAll("@intFromFloat");
|
||||
} else if (mem.eql(u8, slice, "@intToEnum")) {
|
||||
try ais.writer().writeAll("@enumFromInt");
|
||||
} else if (mem.eql(u8, slice, "@intToError")) {
|
||||
try ais.writer().writeAll("@errorFromInt");
|
||||
} else if (mem.eql(u8, slice, "@intToFloat")) {
|
||||
try ais.writer().writeAll("@floatFromInt");
|
||||
} else if (mem.eql(u8, slice, "@intToPtr")) {
|
||||
try ais.writer().writeAll("@ptrFromInt");
|
||||
} else if (mem.eql(u8, slice, "@ptrToInt")) {
|
||||
try ais.writer().writeAll("@intFromPtr");
|
||||
} else if (mem.eql(u8, slice, "@fabs")) {
|
||||
try ais.writer().writeAll("@abs");
|
||||
} else if (mem.eql(u8, slice, "@errSetCast")) {
|
||||
try ais.writer().writeAll("@errorCast");
|
||||
} else {
|
||||
try renderToken(r, builtin_token, .none); // @name
|
||||
}
|
||||
|
||||
if (rewrite_two_param_cast) {
|
||||
// Matches with corresponding logic above builtin name rewrite
|
||||
const after_last_param_token = tree.lastToken(params[1]) + 1;
|
||||
try ais.writer().writeAll("(");
|
||||
try renderExpression(r, params[1], .none);
|
||||
try ais.writer().writeAll(")");
|
||||
if (token_tags[after_last_param_token] != .comma) {
|
||||
// Render all on one line, no trailing comma.
|
||||
return renderToken(r, after_last_param_token, space); // )
|
||||
} else {
|
||||
// Render one param per line.
|
||||
ais.popIndent();
|
||||
try renderToken(r, after_last_param_token, .newline); // ,
|
||||
return renderToken(r, after_last_param_token + 1, space); // )
|
||||
}
|
||||
}
|
||||
try renderToken(r, builtin_token, .none); // @name
|
||||
|
||||
if (params.len == 0) {
|
||||
try renderToken(r, builtin_token + 1, .none); // (
|
||||
|
|
@ -1685,6 +1599,7 @@ fn renderBuiltinCall(
|
|||
}
|
||||
|
||||
if (r.fixups.rebase_imported_paths) |prefix| {
|
||||
const slice = tree.tokenSlice(builtin_token);
|
||||
if (mem.eql(u8, slice, "@import")) f: {
|
||||
const param = params[0];
|
||||
const str_lit_token = main_tokens[param];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue