Package bytecode
Class CodeStruct
- java.lang.Object
-
- bytecode.CodeStruct
-
public class CodeStruct extends java.lang.Object
This class is conceptually analogous to the class CodeFile for the whole program (and to CodeProcedure, responsible for procedures). An instance of this class is to contain a representation of the "code" of a struct.
-
-
Constructor Summary
Constructors Constructor Description CodeStruct(java.lang.String name)
This class is conceptually analogous to the class CodeFile for the whole program (and to CodeProcedure, responsible for procedures).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVariable(java.lang.String name, bytecode.type.CodeType type)
Add a field to a record type and fix its type.int
fieldNumber(java.lang.String name)
Determine the index (an integer) of a field of a struct.byte[]
getBytecode()
Returning the resulting bytecode of the struct.java.lang.String
getName()
A simple get-ter method for the name of the struct.
-
-
-
Constructor Detail
-
CodeStruct
public CodeStruct(java.lang.String name)
This class is conceptually analogous to the class CodeFile for the whole program (and to CodeProcedure, responsible for procedures). An instance of this class is to contain a representation of the "code" of a struct.- Parameters:
name
- of the introduced record type.
-
-
Method Detail
-
addVariable
public void addVariable(java.lang.String name, bytecode.type.CodeType type)
Add a field to a record type and fix its type.- Parameters:
name
- of the field.type
- of the field.
-
fieldNumber
public int fieldNumber(java.lang.String name)
Determine the index (an integer) of a field of a struct.- Parameters:
name
- of the variable (incl. formal parameter)- Returns:
- the so-called index of a variable (incl. formal parameter).
-
getName
public java.lang.String getName()
A simple get-ter method for the name of the struct.- Returns:
- name of the struct.
-
getBytecode
public byte[] getBytecode()
Returning the resulting bytecode of the struct.- Returns:
- the byte code as array of bytes.
-
-