Ejemplo n.º 1
0
    public object VisitArrayDeclarementStatement(Statement.ArrayDeclarement stmt)
    {
        foreach (var ident in stmt.Identifiers)
        {
            var pointer = Util.LEB128encode(memoryPointer);

            current.Locals++;
            var index = environment.Declare(ident);
            // TODO is this needed
            // store a placeholder 0 to the memory
            addInstruction(0x41);
            addInstruction(pointer);

            memoryPointer += 4 * stmt.Size;
            addInstruction(I32_CONST);
            addInstruction(Util.LEB128encode(0));

            addInstruction(0x36, 0x02, 0x00);

            addInstruction(I32_CONST);
            addInstruction(pointer);
            addInstruction(LOCAL_SET);
            addInstruction(Util.LEB128encode(index));
        }
        return(null);
    }
Ejemplo n.º 2
0
 public object VisitArrayDeclarementStatement(Statement.ArrayDeclarement stmt)
 {
     return(null);
 }