Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
caddbbe1
Commit
caddbbe1
authored
Jan 02, 2017
by
Rémi Verschelde
Committed by
GitHub
Jan 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7390 from bojidar-bg/gdscript-assign-error
Disallow assignment to constants and expressions
parents
ac04a932
0b077162
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
gd_parser.cpp
modules/gdscript/gd_parser.cpp
+10
-1
No files found.
modules/gdscript/gd_parser.cpp
View file @
caddbbe1
...
...
@@ -1478,6 +1478,15 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
return
op
;
}
if
(
op
->
arguments
[
0
]
->
type
==
Node
::
TYPE_OPERATOR
)
{
OperatorNode
*
on
=
static_cast
<
OperatorNode
*>
(
op
->
arguments
[
0
]);
if
(
on
->
op
!=
OperatorNode
::
OP_INDEX
&&
on
->
op
!=
OperatorNode
::
OP_INDEX_NAMED
)
{
_set_error
(
"Can't assign to an expression"
,
tokenizer
->
get_token_line
()
-
1
);
error_line
=
op
->
line
;
return
op
;
}
}
}
break
;
default
:
{
break
;
}
}
...
...
@@ -2014,7 +2023,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
}
break
;
default
:
{
Node
*
expression
=
_parse_and_reduce_expression
(
p_block
,
p_static
,
fals
e
,
true
);
Node
*
expression
=
_parse_and_reduce_expression
(
p_block
,
p_static
,
tru
e
,
true
);
if
(
!
expression
)
{
if
(
_recover_from_completion
())
{
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment