Make inline blocks in GDScript more pythonic

Fixes #8001

(cherry picked from commit 18ab88b3f1)
This commit is contained in:
Bojidar Marinov 2017-03-23 20:07:02 +02:00 committed by Rémi Verschelde
parent 0afb9b579f
commit 0c650c2511
1 changed files with 9 additions and 1 deletions

View File

@ -76,7 +76,7 @@ bool GDParser::_enter_indent_block(BlockNode *p_block) {
// be more python-like
int current = tab_level.back()->get();
tab_level.push_back(current + 1);
tab_level.push_back(current);
return true;
//_set_error("newline expected after ':'.");
//return false;
@ -1609,7 +1609,15 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) {
p_block->statements.push_back(nl);
#endif
bool is_first_line = true;
while (true) {
if (!is_first_line && tab_level.back()->prev() && tab_level.back()->prev()->get() == indent_level) {
// pythonic single-line expression, don't parse future lines
tab_level.pop_back();
return;
}
is_first_line = false;
GDTokenizer::Token token = tokenizer->get_token();
if (error_set)