Inline flag definitions
This commit is contained in:
parent
f8b1f968e0
commit
7cc907dc19
4 changed files with 10 additions and 20 deletions
|
|
@ -22,7 +22,7 @@ attributes: []AttributeInfo,
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
pub const ClassFlags = enum(u16) {
|
pub const ClassAccessFlags = EnumFlags(enum(u16) {
|
||||||
public = 0x0001,
|
public = 0x0001,
|
||||||
final = 0x0010,
|
final = 0x0010,
|
||||||
super = 0x0020,
|
super = 0x0020,
|
||||||
|
|
@ -31,9 +31,7 @@ pub const ClassFlags = enum(u16) {
|
||||||
synthetic = 0x1000,
|
synthetic = 0x1000,
|
||||||
annotation = 0x2000,
|
annotation = 0x2000,
|
||||||
@"enum" = 0x4000,
|
@"enum" = 0x4000,
|
||||||
};
|
});
|
||||||
|
|
||||||
pub const ClassAccessFlags = EnumFlags(ClassFlags);
|
|
||||||
|
|
||||||
pub const ParseError = std.Io.Reader.Error || std.mem.Allocator.Error || error {
|
pub const ParseError = std.Io.Reader.Error || std.mem.Allocator.Error || error {
|
||||||
InvalidMagicNumber,
|
InvalidMagicNumber,
|
||||||
|
|
|
||||||
|
|
@ -892,7 +892,7 @@ pub const InnerClasses = struct {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InnerClassFlags = enum(u16) {
|
pub const InnerClassAccessFlags = EnumFlags(enum(u16) {
|
||||||
public = 0x0001,
|
public = 0x0001,
|
||||||
private = 0x0002,
|
private = 0x0002,
|
||||||
protected = 0x0004,
|
protected = 0x0004,
|
||||||
|
|
@ -903,9 +903,7 @@ pub const InnerClasses = struct {
|
||||||
synthetic = 0x1000,
|
synthetic = 0x1000,
|
||||||
annotation = 0x2000,
|
annotation = 0x2000,
|
||||||
@"enum" = 0x4000,
|
@"enum" = 0x4000,
|
||||||
};
|
});
|
||||||
|
|
||||||
pub const InnerClassAccessFlags = EnumFlags(InnerClassFlags);
|
|
||||||
|
|
||||||
pub fn parse(input: *std.Io.Reader, allocator: std.mem.Allocator) ParseError!Self {
|
pub fn parse(input: *std.Io.Reader, allocator: std.mem.Allocator) ParseError!Self {
|
||||||
const number_of_classes = try input.takeInt(u16, .big);
|
const number_of_classes = try input.takeInt(u16, .big);
|
||||||
|
|
@ -1474,13 +1472,11 @@ pub const MethodParameters = struct {
|
||||||
name_index: u16,
|
name_index: u16,
|
||||||
access_flags: ParameterAccessFlags,
|
access_flags: ParameterAccessFlags,
|
||||||
|
|
||||||
pub const ParameterFlags = enum(u16) {
|
pub const ParameterAccessFlags = EnumFlags(enum(u16) {
|
||||||
final = 0x0010,
|
final = 0x0010,
|
||||||
synthetic = 0x1000,
|
synthetic = 0x1000,
|
||||||
mandated = 0x8000,
|
mandated = 0x8000,
|
||||||
};
|
});
|
||||||
|
|
||||||
pub const ParameterAccessFlags = EnumFlags(ParameterFlags);
|
|
||||||
|
|
||||||
pub fn indentedFormat(
|
pub fn indentedFormat(
|
||||||
self: *const Parameter,
|
self: *const Parameter,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ attributes: []AttributeInfo,
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
pub const FieldFlags = enum(u16) {
|
pub const FieldAccessFlags = EnumFlags(enum(u16) {
|
||||||
public = 0x0001,
|
public = 0x0001,
|
||||||
private = 0x0002,
|
private = 0x0002,
|
||||||
protected = 0x0004,
|
protected = 0x0004,
|
||||||
|
|
@ -24,9 +24,7 @@ pub const FieldFlags = enum(u16) {
|
||||||
transient = 0x0080,
|
transient = 0x0080,
|
||||||
synthetic = 0x1000,
|
synthetic = 0x1000,
|
||||||
@"enum" = 0x4000,
|
@"enum" = 0x4000,
|
||||||
};
|
});
|
||||||
|
|
||||||
pub const FieldAccessFlags = EnumFlags(FieldFlags);
|
|
||||||
|
|
||||||
pub fn parse(input: *std.Io.Reader, constant_pool: []const ?ConstantPoolInfo, allocator: std.mem.Allocator) !Self {
|
pub fn parse(input: *std.Io.Reader, constant_pool: []const ?ConstantPoolInfo, allocator: std.mem.Allocator) !Self {
|
||||||
const access_flags: FieldAccessFlags = .{ .mask = try input.takeInt(u16, .big) };
|
const access_flags: FieldAccessFlags = .{ .mask = try input.takeInt(u16, .big) };
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ attributes: []AttributeInfo,
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
pub const MethodFlags = enum(u16) {
|
pub const MethodAccessFlags = EnumFlags(enum(u16) {
|
||||||
public = 0x0001,
|
public = 0x0001,
|
||||||
private = 0x0002,
|
private = 0x0002,
|
||||||
protected = 0x0004,
|
protected = 0x0004,
|
||||||
|
|
@ -27,9 +27,7 @@ pub const MethodFlags = enum(u16) {
|
||||||
abstract = 0x0400,
|
abstract = 0x0400,
|
||||||
strict = 0x0800,
|
strict = 0x0800,
|
||||||
synthetic = 0x1000,
|
synthetic = 0x1000,
|
||||||
};
|
});
|
||||||
|
|
||||||
pub const MethodAccessFlags = EnumFlags(MethodFlags);
|
|
||||||
|
|
||||||
pub fn parse(input: *std.Io.Reader, constant_pool: []const ?ConstantPoolInfo, allocator: std.mem.Allocator) !Self {
|
pub fn parse(input: *std.Io.Reader, constant_pool: []const ?ConstantPoolInfo, allocator: std.mem.Allocator) !Self {
|
||||||
const access_flags: MethodAccessFlags = .{ .mask = try input.takeInt(u16, .big) };
|
const access_flags: MethodAccessFlags = .{ .mask = try input.takeInt(u16, .big) };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue