snake5 icon

new lang more progress

snake5 | PRO | 01/15/15 08:30:39 PM UTC | 0 ⭐ | 933 👁️ | Never ⏰ | []
text |

3.62 KB

|

None

|

0 👍

/

0 👎

/// CODE ///
	func __getindex( index : int32 ) : T
	{
		if( index < 0 || index >= m_size )
		{
			WARNING( "array index out of bounds" );
			return T();
		}
		return m_data[ index ];
	}
/// OUTPUT ///
FUNC (struct=6 op=30 opsub=0 tt=75)
{
  name = 'data1.__getindex'
  orig_datatype = 'T'
  datatype = ''
  orig_typeinfo:
    IDENT (struct=12 op=1 opsub=0 tt=78)
      name = 'T'
  typeinfo: <null>
  params:
    ARG (struct=2 op=10 opsub=0 tt=78)
    {
      name = 'index'
      orig_datatype = 'int32'
      datatype = ''
      orig_typeinfo:
        IDENT (struct=12 op=1 opsub=0 tt=78)
          name = 'int32'
      typeinfo: <null>
      value: <null>
    }
  code:
    BLOCK (struct=4 op=21 opsub=0 tt=75)
    {
      locals: <null>
      code:
      {
        IF/ELSE (struct=9 op=22 opsub=0 tt=75)
        {
          test:
            || (struct=7 op=4 opsub=0 tt=226)
            {
              arg:
              {
                < (struct=7 op=4 opsub=0 tt=206)
                {
                  arg:
                  {
                    IDENT (struct=12 op=1 opsub=0 tt=78)
                      name = 'index'
                    uint8(0) (struct=13 op=3 opsub=0 tt=86)
                  }
                }
                >= (struct=7 op=4 opsub=0 tt=205)
                {
                  arg:
                  {
                    IDENT (struct=12 op=1 opsub=0 tt=78)
                      name = 'index'
                    IDENT (struct=12 op=1 opsub=0 tt=78)
                      name = 'm_size'
                  }
                }
              }
            }
          ontrue:
            BLOCK (struct=4 op=21 opsub=0 tt=78)
            {
              locals: <null>
              code:
              {
                FCALL (struct=7 op=6 opsub=0 tt=40)
                {
                  arg:
                  {
                    IDENT (struct=12 op=1 opsub=0 tt=78)
                      name = 'WARNING'
                    EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
                    {
                      arg:
                        str(array index out of bounds) (struct=13 op=3 opsub=0 tt=83)
                    }
                  }
                }
                RETURN (struct=7 op=18 opsub=0 tt=78)
                {
                  arg:
                    FCALL (struct=7 op=6 opsub=0 tt=40)
                    {
                      arg:
                      {
                        IDENT (struct=12 op=1 opsub=0 tt=78)
                          name = 'T'
                        EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
                        {
                          arg: <null>
                        }
                      }
                    }
                }
              }
            }
          onfalse: <null>
        }
        RETURN (struct=7 op=18 opsub=0 tt=78)
        {
          arg:
            INDEX (struct=7 op=7 opsub=0 tt=91)
            {
              arg:
              {
                IDENT (struct=12 op=1 opsub=0 tt=78)
                  name = 'm_data'
                IDENT (struct=12 op=1 opsub=0 tt=78)
                  name = 'index'
              }
            }
        }
      }
    }
  bytecode:
    DECLARG <int32> index [11]
    IF
    CONST <uint8> 0 [25] : 00
    LT <bool> 1 [28] <= index [11], 0 [25]
    GTEQ <> 2 [29] <= index [11], m_size [13]
    BLN_OR <bool> 3 [30] <= 1 [28], 2 [29]
    DO
    FCALL <> 4 [31] <= func:WARNING [14] args(0):
    FCALL <> 5 [32] <= func:T [12] args(0):
    RETURN 5 [32]
    ENDO
    RETURN  [0]
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎