Jump to content

[WONTFIX] UnigineScript bug compiler ?


photo

Recommended Posts

Hi,

I just found a strange behaviour with the unigineScript compilation. Indeed i was using this function :
 

int getId()
{
    log.message("getId");
    return m_id
}

 like you can see, i forget a ';' at the end of my return but the compiler don't crash at all in this situation.

But if I write 

int getId()
{
   log.message("getId")
   return m_id
}

I've got a parser::expectSymbol() message box and can't load the world.

this is normal or is it a bug ?

Thx.

Link to comment

Hi Yann,

 

What SDK version are you currently using? With the latest 2.0 RC even the first code variant is not compiling: 

return m_id
unigine_project/unigine_project.cpp:6: Interpreter::parse_expression(): unknown token "m_id" in "m_id" expression

As for the second case - I think this is correct behavior, because you can see the line of code with the error. The compiler says that instead of ";" you got r (the first letter of the return statement).

 

I would recommend you to always put semicolon after the return statement to avoid any other errors.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi,

I'm on the r1818 in DX11 using debug launch.

I know that the second case is the normal behaviour, it's why I post this thread... And for you first compiling error, the message is about tha fact that "m_id" is not an declared object...


So i still have normal compiling with the code :

int getId()
{  
    int m_id = 1;   
    log.message("getId");    
    return m_id
}

Ans it's only on a return.

For exemple :

int getId()
{  
    int m_id = 1;   
    log.message("getId");     
    return m_id;
}

is compiling (normal)

int getId()
{  
    int m_id = 1;   
    log.message("getId")    
    return m_id
}

is not compiling (normal)

int getId()
{  
    int m_id = 1;   
    log.message("getId");     
    return m_id
}

compiling ?! (not normal)

int getId()
{  
    int m_id = 1;  
    log.message("getId");    
    break
}

not compiling (normal)


I only asking why the compiling let accept such writing. It is not fatal but it could create bad habit for junior programmer.

Thx.

Link to comment

Hi Yann,

 

Not it is more clear to me, thanks for the additional information.

 

I will surely pass this information to the developers. Maybe there is some kind of additional behavior only for return statement, so right now it is allowed not to put semicolon after it.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi Yann,

 

I've asked dev team and they said that it is not a bug. return statement can be used without a semicolon. So, in your examples:
 

int getId()
{  
    int m_id = 1;   
    log.message("getId");     
    return m_id
}

compiler will think that this code is valid.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...