printing methods

This commit is contained in:
BENEDEK 2024-04-13 22:47:56 +02:00
parent af118981c4
commit 0def8039e1

View File

@ -456,27 +456,28 @@ void ClassFile_info(const ClassFile* cf) {
printf("\t%s %s%s%s%s %s", access, flags & ACC_STATIC ? "static " : "", flags & ACC_FINAL ? "final " : "", flags & ACC_VOLATLE ? "volatile " : "", printf("\t%s %s%s%s%s %s", access, flags & ACC_STATIC ? "static " : "", flags & ACC_FINAL ? "final " : "", flags & ACC_VOLATLE ? "volatile " : "",
descriptor, name); descriptor, name);
// TODO: print field attributes
for (u2 j = 0; j < cf->fields[i].attributes_count; j++) { for (u2 j = 0; j < cf->fields[i].attributes_count; j++) {
switch (cf->fields[i].attributes[j]._tag) {
case CONSTANT_VALUE:
break;
case BOOTSTRAP_METHODS:
break;
case NEST_HOST:
break;
case NEST_MEMBERS:
break;
case PERMITTED_SUBCLASSES:
break;
default:
break;
}
} }
printf(";\n"); printf(";\n");
} }
// methods // methods
for (u2 i = 0; i < cf->methods_count; i++) {
u2 flags = cf->methods[i].access_flags;
char* access = flags & ACC_PUBLIC ? "public" : flags & ACC_PRIVATE ? "private" : flags & ACC_PROTECTED ? "protected" : "";
char* descriptor = (char*)cf->constant_pool[cf->methods[i].descriptor_index - 1].info.utf8_info.bytes;
char* name = (char*)cf->constant_pool[cf->methods[i].name_index - 1].info.utf8_info.bytes;
printf("\t%s %s%s%s%s %s", access, flags & ACC_STATIC ? "static " : "", flags & ACC_FINAL ? "final " : "", flags & ACC_VOLATLE ? "volatile " : "",
descriptor, name);
// TODO: print field attributes
for (u2 j = 0; j < cf->methods[i].attributes_count; j++) {
}
printf(";\n");
}
} }
char* ClassFile_resolve_NameAnyType(const ClassFile* cf, CONSTANT_NameAndType_info info) { char* ClassFile_resolve_NameAnyType(const ClassFile* cf, CONSTANT_NameAndType_info info) {