public IByteElement GetByteElement(ClassesContainer container, IByteElement parent) { ByteBlock meta = new ByteBlock((ByteClass)parent); Value.GenerateBytecode(container, meta); ByteField field = new ByteField((ByteClass)parent, Modifiers, Name, meta); return(field); }
public IByteElement GetByteElement(NovFile file, ClassesContainer container, IByteElement parent) { ByteClass byteClass = new ByteClass(file, this.ClassName, Type); foreach (var method in this.Methods) { byteClass.Methods.Add((ByteMethod)method.Value.GetByteElement(container, byteClass)); } foreach (var field in this.Fields) { byteClass.Fields.Add((ByteField)field.Value.GetByteElement(container, byteClass)); } return(byteClass); }
public IByteElement GetByteElement(ClassesContainer container, IByteElement parent) { ByteMethod result = new ByteMethod(this.Name, Modifiers, Parameters.Count, (ByteClass)parent); foreach (var parameter in Parameters) { result.ByteBlock.SymbolTable.Bind(parameter.Name, parameter.RawType); } foreach (var statement in Statements) { statement.GenerateBytecode(container, result.ByteBlock); } if (result.ByteBlock.Instructions.Count == 0 || (!(result.ByteBlock.Instructions.Last() is ReturnCode))) { result.ByteBlock.Instructions.Add(new ReturnCode()); } return(result); }