mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
GDScript: Add lambda syntax parsing
Lambda syntax is the same as a the function syntax (using the same `func` keyword) except that the name is optional and it can be embedded anywhere an expression is expected. E.g.: func _ready(): var my_lambda = func(x): print(x) my_lambda.call("hello")
This commit is contained in:
parent
f879a08a62
commit
c6e66a43b0
6 changed files with 229 additions and 68 deletions
|
@ -242,6 +242,16 @@ void GDScriptTokenizer::set_multiline_mode(bool p_state) {
|
|||
multiline_mode = p_state;
|
||||
}
|
||||
|
||||
void GDScriptTokenizer::push_expression_indented_block() {
|
||||
indent_stack_stack.push_back(indent_stack);
|
||||
}
|
||||
|
||||
void GDScriptTokenizer::pop_expression_indented_block() {
|
||||
ERR_FAIL_COND(indent_stack_stack.size() == 0);
|
||||
indent_stack = indent_stack_stack.back()->get();
|
||||
indent_stack_stack.pop_back();
|
||||
}
|
||||
|
||||
int GDScriptTokenizer::get_cursor_line() const {
|
||||
return cursor_line;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue