Skip to content

Commit

Permalink
Data-driven addition of enum constants (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
XFactHD authored Jun 11, 2024
1 parent b36b821 commit 73b9200
Show file tree
Hide file tree
Showing 17 changed files with 1,130 additions and 222 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) NeoForged and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/

package net.neoforged.fml.common.asm;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodNode;

public class ListGeneratorAdapter extends GeneratorAdapter {
public final InsnList insnList;

public ListGeneratorAdapter(InsnList insnList) {
super(Opcodes.ASM9, null, 0, "", "()V");
this.insnList = insnList;
MethodNode method = new MethodNode();
method.instructions = insnList;
mv = method;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) NeoForged and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/

package net.neoforged.fml.common.asm.enumextension;

import java.util.List;
import org.objectweb.asm.Type;

sealed interface EnumParameters {
record Constant(List<Object> params) implements EnumParameters {}

record FieldReference(Type owner, String fieldName) implements EnumParameters {}

record MethodReference(Type owner, String methodName) implements EnumParameters {}
}
Loading

0 comments on commit 73b9200

Please sign in to comment.