Skip to content

Commit 56b7655

Browse files
committed
revert the billion changes
1 parent 12f904f commit 56b7655

File tree

13 files changed

+45
-45
lines changed

13 files changed

+45
-45
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ set(ZIG_STAGE2_SOURCES
407407
lib/std/c.zig
408408
lib/std/coff.zig
409409
lib/std/crypto.zig
410-
lib/std/static_string_map.zig
411410
lib/std/crypto/blake3.zig
412411
lib/std/crypto/siphash.zig
413412
lib/std/debug.zig
@@ -485,6 +484,7 @@ set(ZIG_STAGE2_SOURCES
485484
lib/std/process/Child.zig
486485
lib/std/sort.zig
487486
lib/std/start.zig
487+
lib/std/static_string_map.zig
488488
lib/std/std.zig
489489
lib/std/time.zig
490490
lib/std/treap.zig

lib/compiler/aro/aro/LangOpts.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub const Standard = enum {
4747
/// Working Draft for ISO C23 with GNU extensions
4848
gnu23,
4949

50-
const name_map = std.StaticStringMap(Standard).initComptime(.{
50+
const NameMap = std.StaticStringMap(Standard).initComptime(.{
5151
.{ "c89", .c89 }, .{ "c90", .c89 }, .{ "iso9899:1990", .c89 },
5252
.{ "iso9899:199409", .iso9899 }, .{ "gnu89", .gnu89 }, .{ "gnu90", .gnu89 },
5353
.{ "c99", .c99 }, .{ "iso9899:1999", .c99 }, .{ "c9x", .c99 },
@@ -141,7 +141,7 @@ preserve_comments_in_macros: bool = false,
141141
gnuc_version: u32 = 0,
142142

143143
pub fn setStandard(self: *LangOpts, name: []const u8) error{InvalidStandard}!void {
144-
self.standard = Standard.name_map.get(name) orelse return error.InvalidStandard;
144+
self.standard = Standard.NameMap.get(name) orelse return error.InvalidStandard;
145145
}
146146

147147
pub fn enableMSExtensions(self: *LangOpts) void {

lib/compiler/resinator/compile.zig

+15-15
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ pub const Compiler = struct {
13451345
const accelerator: *Node.Accelerator = @alignCast(@fieldParentPtr("base", accel_node));
13461346
var modifiers = res.AcceleratorModifiers{};
13471347
for (accelerator.type_and_options) |type_or_option| {
1348-
const modifier = rc.AcceleratorTypeAndOptions.Map.get(type_or_option.slice(self.source)).?;
1348+
const modifier = rc.AcceleratorTypeAndOptions.map.get(type_or_option.slice(self.source)).?;
13491349
modifiers.apply(modifier);
13501350
}
13511351
if (accelerator.event.isNumberExpression() and !modifiers.explicit_ascii_or_virtkey) {
@@ -1428,7 +1428,7 @@ pub const Compiler = struct {
14281428
.simple_statement => {
14291429
const simple_statement: *Node.SimpleStatement = @alignCast(@fieldParentPtr("base", optional_statement));
14301430
const statement_identifier = simple_statement.identifier;
1431-
const statement_type = rc.OptionalStatements.DialogMap.get(statement_identifier.slice(self.source)) orelse continue;
1431+
const statement_type = rc.OptionalStatements.dialog_map.get(statement_identifier.slice(self.source)) orelse continue;
14321432
switch (statement_type) {
14331433
.style, .exstyle => {
14341434
const style = evaluateFlagsExpressionWithDefault(0, simple_statement.value, self.source, self.input_code_pages);
@@ -1563,7 +1563,7 @@ pub const Compiler = struct {
15631563

15641564
for (skipped_menu_or_classes.items) |simple_statement| {
15651565
const statement_identifier = simple_statement.identifier;
1566-
const statement_type = rc.OptionalStatements.DialogMap.get(statement_identifier.slice(self.source)) orelse continue;
1566+
const statement_type = rc.OptionalStatements.dialog_map.get(statement_identifier.slice(self.source)) orelse continue;
15671567
try self.addErrorDetails(.{
15681568
.err = .duplicate_menu_or_class_skipped,
15691569
.type = .warning,
@@ -1813,7 +1813,7 @@ pub const Compiler = struct {
18131813
bytes_written_so_far: u32,
18141814
controls_by_id: *std.AutoHashMap(u32, *const Node.ControlStatement),
18151815
) !void {
1816-
const control_type = rc.Control.Map.get(control.type.slice(self.source)).?;
1816+
const control_type = rc.Control.map.get(control.type.slice(self.source)).?;
18171817

18181818
// Each control must be at a 4-byte boundary. However, the Windows RC
18191819
// compiler will miscompile controls if their extra data ends on an odd offset.
@@ -1958,7 +1958,7 @@ pub const Compiler = struct {
19581958
const literal_node: *Node.Literal = @alignCast(@fieldParentPtr("base", class_node));
19591959
const literal_slice = literal_node.token.slice(self.source);
19601960
// This succeeding is guaranteed by the parser
1961-
const control_class = rc.ControlClass.Map.get(literal_slice) orelse unreachable;
1961+
const control_class = rc.ControlClass.map.get(literal_slice) orelse unreachable;
19621962
const ordinal = NameOrOrdinal{ .ordinal = @intFromEnum(control_class) };
19631963
try ordinal.write(data_writer);
19641964
}
@@ -2182,7 +2182,7 @@ pub const Compiler = struct {
21822182
var flags = res.MenuItemFlags{};
21832183
for (menu_item.option_list) |option_token| {
21842184
// This failing would be a bug in the parser
2185-
const option = rc.MenuItem.Option.Map.get(option_token.slice(self.source)) orelse unreachable;
2185+
const option = rc.MenuItem.Option.map.get(option_token.slice(self.source)) orelse unreachable;
21862186
flags.apply(option);
21872187
}
21882188
if (is_last_of_parent) flags.markLast();
@@ -2200,7 +2200,7 @@ pub const Compiler = struct {
22002200
var flags = res.MenuItemFlags{ .value = res.MF.POPUP };
22012201
for (popup.option_list) |option_token| {
22022202
// This failing would be a bug in the parser
2203-
const option = rc.MenuItem.Option.Map.get(option_token.slice(self.source)) orelse unreachable;
2203+
const option = rc.MenuItem.Option.map.get(option_token.slice(self.source)) orelse unreachable;
22042204
flags.apply(option);
22052205
}
22062206
if (is_last_of_parent) flags.markLast();
@@ -2296,7 +2296,7 @@ pub const Compiler = struct {
22962296
switch (fixed_info.id) {
22972297
.version_statement => {
22982298
const version_statement: *Node.VersionStatement = @alignCast(@fieldParentPtr("base", fixed_info));
2299-
const version_type = rc.VersionInfo.Map.get(version_statement.type.slice(self.source)).?;
2299+
const version_type = rc.VersionInfo.map.get(version_statement.type.slice(self.source)).?;
23002300

23012301
// Ensure that all parts are cleared for each version, to properly account for
23022302
// potential duplicate PRODUCTVERSION/FILEVERSION statements
@@ -2346,7 +2346,7 @@ pub const Compiler = struct {
23462346
},
23472347
.simple_statement => {
23482348
const statement: *Node.SimpleStatement = @alignCast(@fieldParentPtr("base", fixed_info));
2349-
const statement_type = rc.VersionInfo.Map.get(statement.identifier.slice(self.source)).?;
2349+
const statement_type = rc.VersionInfo.map.get(statement.identifier.slice(self.source)).?;
23502350
const value = evaluateNumberExpression(statement.value, self.source, self.input_code_pages);
23512351
switch (statement_type) {
23522352
.file_flags_mask => fixed_file_info.file_flags_mask = value.value,
@@ -2555,7 +2555,7 @@ pub const Compiler = struct {
25552555
/// Expects this to be a top-level VERSION or CHARACTERISTICS statement
25562556
pub fn writeTopLevelSimpleStatement(self: *Compiler, node: *Node.SimpleStatement) void {
25572557
const value = Compiler.evaluateNumberExpression(node.value, self.source, self.input_code_pages);
2558-
const statement_type = rc.TopLevelKeywords.Map.get(node.identifier.slice(self.source)).?;
2558+
const statement_type = rc.TopLevelKeywords.map.get(node.identifier.slice(self.source)).?;
25592559
switch (statement_type) {
25602560
.characteristics => self.state.characteristics = value.value,
25612561
.version => self.state.version = value.value,
@@ -2735,7 +2735,7 @@ pub const Compiler = struct {
27352735

27362736
fn applyToMemoryFlags(flags: *MemoryFlags, tokens: []Token, source: []const u8) void {
27372737
for (tokens) |token| {
2738-
const attribute = rc.CommonResourceAttributes.Map.get(token.slice(source)).?;
2738+
const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;
27392739
flags.set(attribute);
27402740
}
27412741
}
@@ -2757,7 +2757,7 @@ pub const Compiler = struct {
27572757
const initial_flags = flags.*;
27582758
var flags_set = std.enums.EnumSet(rc.CommonResourceAttributes).initEmpty();
27592759
for (tokens) |token| {
2760-
const attribute = rc.CommonResourceAttributes.Map.get(token.slice(source)).?;
2760+
const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;
27612761
flags_set.insert(attribute);
27622762
}
27632763
if (!flags_set.contains(.preload)) return;
@@ -2767,7 +2767,7 @@ pub const Compiler = struct {
27672767
// For example, `PRELOAD LOADONCALL` will result in default flags, but
27682768
// `LOADONCALL PRELOAD` will have PRELOAD set after they are both applied in order.
27692769
for (tokens) |token| {
2770-
const attribute = rc.CommonResourceAttributes.Map.get(token.slice(source)).?;
2770+
const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;
27712771
switch (attribute) {
27722772
.preload, .loadoncall => flags.set(attribute),
27732773
else => {},
@@ -2786,7 +2786,7 @@ pub const Compiler = struct {
27862786
};
27872787
const discardable_shared_or_pure_specified = flags_set.intersectWith(shared_set).count() != 0;
27882788
for (tokens) |token| {
2789-
const attribute = rc.CommonResourceAttributes.Map.get(token.slice(source)).?;
2789+
const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;
27902790
flags.setGroup(attribute, !discardable_shared_or_pure_specified);
27912791
}
27922792
}
@@ -2800,7 +2800,7 @@ pub const Compiler = struct {
28002800
},
28012801
.simple_statement => {
28022802
const simple_statement: *Node.SimpleStatement = @alignCast(@fieldParentPtr("base", node));
2803-
const statement_type = rc.OptionalStatements.Map.get(simple_statement.identifier.slice(source)) orelse continue;
2803+
const statement_type = rc.OptionalStatements.map.get(simple_statement.identifier.slice(source)) orelse continue;
28042804
const result = Compiler.evaluateNumberExpression(simple_statement.value, source, code_page_lookup);
28052805
switch (statement_type) {
28062806
.version => version.* = result.value,

lib/compiler/resinator/parse.zig

+13-13
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub const Parser = struct {
114114
var common_resource_attributes: std.ArrayListUnmanaged(Token) = .empty;
115115
while (true) {
116116
const maybe_common_resource_attribute = try self.lookaheadToken(.normal);
117-
if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.Map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) {
117+
if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) {
118118
try common_resource_attributes.append(self.state.arena, maybe_common_resource_attribute);
119119
self.nextToken(.normal) catch unreachable;
120120
} else {
@@ -136,8 +136,8 @@ pub const Parser = struct {
136136
const lookahead_token = try self.lookaheadToken(.normal);
137137
if (lookahead_token.id != .literal) break;
138138
const slice = lookahead_token.slice(self.lexer.buffer);
139-
const optional_statement_type = rc.OptionalStatements.Map.get(slice) orelse switch (resource) {
140-
.dialog, .dialogex => rc.OptionalStatements.DialogMap.get(slice) orelse break,
139+
const optional_statement_type = rc.OptionalStatements.map.get(slice) orelse switch (resource) {
140+
.dialog, .dialogex => rc.OptionalStatements.dialog_map.get(slice) orelse break,
141141
else => break,
142142
};
143143
self.nextToken(.normal) catch unreachable;
@@ -281,7 +281,7 @@ pub const Parser = struct {
281281
const first_token = self.state.token;
282282
std.debug.assert(first_token.id == .literal);
283283

284-
if (rc.TopLevelKeywords.Map.get(first_token.slice(self.lexer.buffer))) |keyword| switch (keyword) {
284+
if (rc.TopLevelKeywords.map.get(first_token.slice(self.lexer.buffer))) |keyword| switch (keyword) {
285285
.language => {
286286
const language_statement = try self.parseLanguageStatement();
287287
return language_statement;
@@ -468,7 +468,7 @@ pub const Parser = struct {
468468
if (!(try self.parseOptionalToken(.comma))) break;
469469

470470
try self.nextToken(.normal);
471-
if (!rc.AcceleratorTypeAndOptions.Map.has(self.tokenSlice())) {
471+
if (!rc.AcceleratorTypeAndOptions.map.has(self.tokenSlice())) {
472472
return self.addErrorDetailsAndFail(.{
473473
.err = .expected_something_else,
474474
.token = self.state.token,
@@ -854,7 +854,7 @@ pub const Parser = struct {
854854
/// control statement (or unchanged if the function returns null).
855855
fn parseControlStatement(self: *Self, resource: Resource) Error!?*Node {
856856
const control_token = try self.lookaheadToken(.normal);
857-
const control = rc.Control.Map.get(control_token.slice(self.lexer.buffer)) orelse return null;
857+
const control = rc.Control.map.get(control_token.slice(self.lexer.buffer)) orelse return null;
858858
self.nextToken(.normal) catch unreachable;
859859

860860
try self.skipAnyCommas();
@@ -890,7 +890,7 @@ pub const Parser = struct {
890890
class = try self.parseExpression(.{});
891891
if (class.?.id == .literal) {
892892
const class_literal: *Node.Literal = @alignCast(@fieldParentPtr("base", class.?));
893-
const is_invalid_control_class = class_literal.token.id == .literal and !rc.ControlClass.Map.has(class_literal.token.slice(self.lexer.buffer));
893+
const is_invalid_control_class = class_literal.token.id == .literal and !rc.ControlClass.map.has(class_literal.token.slice(self.lexer.buffer));
894894
if (is_invalid_control_class) {
895895
return self.addErrorDetailsAndFail(.{
896896
.err = .expected_something_else,
@@ -986,7 +986,7 @@ pub const Parser = struct {
986986

987987
fn parseToolbarButtonStatement(self: *Self) Error!?*Node {
988988
const keyword_token = try self.lookaheadToken(.normal);
989-
const button_type = rc.ToolbarButton.Map.get(keyword_token.slice(self.lexer.buffer)) orelse return null;
989+
const button_type = rc.ToolbarButton.map.get(keyword_token.slice(self.lexer.buffer)) orelse return null;
990990
self.nextToken(.normal) catch unreachable;
991991

992992
switch (button_type) {
@@ -1016,7 +1016,7 @@ pub const Parser = struct {
10161016
/// menuitem statement (or unchanged if the function returns null).
10171017
fn parseMenuItemStatement(self: *Self, resource: Resource, top_level_menu_id_token: Token, nesting_level: u32) Error!?*Node {
10181018
const menuitem_token = try self.lookaheadToken(.normal);
1019-
const menuitem = rc.MenuItem.Map.get(menuitem_token.slice(self.lexer.buffer)) orelse return null;
1019+
const menuitem = rc.MenuItem.map.get(menuitem_token.slice(self.lexer.buffer)) orelse return null;
10201020
self.nextToken(.normal) catch unreachable;
10211021

10221022
if (nesting_level > max_nested_menu_level) {
@@ -1067,7 +1067,7 @@ pub const Parser = struct {
10671067
var options: std.ArrayListUnmanaged(Token) = .empty;
10681068
while (true) {
10691069
const option_token = try self.lookaheadToken(.normal);
1070-
if (!rc.MenuItem.Option.Map.has(option_token.slice(self.lexer.buffer))) {
1070+
if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
10711071
break;
10721072
}
10731073
self.nextToken(.normal) catch unreachable;
@@ -1102,7 +1102,7 @@ pub const Parser = struct {
11021102
var options: std.ArrayListUnmanaged(Token) = .empty;
11031103
while (true) {
11041104
const option_token = try self.lookaheadToken(.normal);
1105-
if (!rc.MenuItem.Option.Map.has(option_token.slice(self.lexer.buffer))) {
1105+
if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
11061106
break;
11071107
}
11081108
self.nextToken(.normal) catch unreachable;
@@ -1256,7 +1256,7 @@ pub const Parser = struct {
12561256
/// version statement (or unchanged if the function returns null).
12571257
fn parseVersionStatement(self: *Self) Error!?*Node {
12581258
const type_token = try self.lookaheadToken(.normal);
1259-
const statement_type = rc.VersionInfo.Map.get(type_token.slice(self.lexer.buffer)) orelse return null;
1259+
const statement_type = rc.VersionInfo.map.get(type_token.slice(self.lexer.buffer)) orelse return null;
12601260
self.nextToken(.normal) catch unreachable;
12611261
switch (statement_type) {
12621262
.file_version, .product_version => {
@@ -1300,7 +1300,7 @@ pub const Parser = struct {
13001300
/// version BLOCK/VALUE (or unchanged if the function returns null).
13011301
fn parseVersionBlockOrValue(self: *Self, top_level_version_id_token: Token, nesting_level: u32) Error!?*Node {
13021302
const keyword_token = try self.lookaheadToken(.normal);
1303-
const keyword = rc.VersionBlock.Map.get(keyword_token.slice(self.lexer.buffer)) orelse return null;
1303+
const keyword = rc.VersionBlock.map.get(keyword_token.slice(self.lexer.buffer)) orelse return null;
13041304
self.nextToken(.normal) catch unreachable;
13051305

13061306
if (nesting_level > max_nested_version_level) {

lib/std/crypto/Certificate.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ fn parseEnum(comptime E: type, bytes: []const u8, element: der.Element) ParseEnu
704704
if (element.identifier.tag != .object_identifier)
705705
return error.CertificateFieldHasWrongDataType;
706706
const oid_bytes = bytes[element.slice.start..element.slice.end];
707-
return E.Map.get(oid_bytes) orelse return error.CertificateHasUnrecognizedObjectId;
707+
return E.map.get(oid_bytes) orelse return error.CertificateHasUnrecognizedObjectId;
708708
}
709709

710710
pub const ParseVersionError = error{ UnsupportedCertificateVersion, CertificateFieldHasInvalidLength };

lib/std/fs/test.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ test "walker" {
16651665
.{ "dir3" ++ fs.path.sep_str ++ "sub2" ++ fs.path.sep_str ++ "subsub1", {} },
16661666
});
16671667

1668-
const expected_basename = std.StaticStringMap(void).initComptime(.{
1668+
const expected_basenames = std.StaticStringMap(void).initComptime(.{
16691669
.{ "dir1", {} },
16701670
.{ "dir2", {} },
16711671
.{ "dir3", {} },
@@ -1684,7 +1684,7 @@ test "walker" {
16841684

16851685
var num_walked: usize = 0;
16861686
while (try walker.next()) |entry| {
1687-
testing.expect(expected_basename.has(entry.basename)) catch |err| {
1687+
testing.expect(expected_basenames.has(entry.basename)) catch |err| {
16881688
std.debug.print("found unexpected basename: {s}\n", .{std.fmt.fmtSliceEscapeLower(entry.basename)});
16891689
return err;
16901690
};

0 commit comments

Comments
 (0)