Merge "Minor refactorings related to SCL constructors"
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / constants / componentaccess / FieldComponentAccess.java
1 package org.simantics.scl.compiler.constants.componentaccess;
2
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.constants.generic.MethodRef;
5 import org.simantics.scl.compiler.constants.generic.MethodRef.FieldRef;
6 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
7
8 public class FieldComponentAccess implements ComponentAccess {
9         public final String fieldName;
10
11         public FieldComponentAccess(String fieldName) {
12                 this.fieldName = fieldName;
13         }
14
15         @Override
16         public void load(MethodBuilder mb, String baseClass, TypeDesc returnType) {
17                 mb.loadField(baseClass, fieldName, returnType);
18         }
19
20         @Override
21         public MethodRef toMethodRef(String baseClass, TypeDesc returnType) {
22                 return new FieldRef(baseClass, fieldName, returnType);
23         }
24 }