1 package org.simantics.scl.compiler.internal.codegen.utils;
3 import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
4 import org.cojen.classfile.TypeDesc;
5 import org.simantics.scl.runtime.SCLContext;
7 public enum SCLContextPreparationStep implements PreparationStep<LocalVariable> {
10 public final static TypeDesc SCL_CONTEXT = TypeDesc.forClass(SCLContext.class);
12 public static LocalVariable getCurrent(MethodBuilder mb) {
13 LocalVariable var = mb.getPreparation(INSTANCE);
15 var = mb.createLocalVariable("sclContext", SCL_CONTEXT);
16 mb.invokeStatic(SCL_CONTEXT, "getCurrent", SCL_CONTEXT, Constants.EMPTY_TYPEDESC_ARRAY);
18 mb.addPreparation(INSTANCE, var);