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
e7f056df
Commit
e7f056df
authored
May 13, 2020
by
Thakee Nathees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regression: static func can't access const fix
parent
2231673d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
gdscript_parser.cpp
modules/gdscript/gdscript_parser.cpp
+6
-3
gdscript_parser.h
modules/gdscript/gdscript_parser.h
+1
-1
No files found.
modules/gdscript/gdscript_parser.cpp
View file @
e7f056df
...
...
@@ -7507,7 +7507,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
return
return_type
;
}
bool
GDScriptParser
::
_get_member_type
(
const
DataType
&
p_base_type
,
const
StringName
&
p_member
,
DataType
&
r_member_type
)
const
{
bool
GDScriptParser
::
_get_member_type
(
const
DataType
&
p_base_type
,
const
StringName
&
p_member
,
DataType
&
r_member_type
,
bool
*
r_is_const
)
const
{
DataType
base_type
=
p_base_type
;
// Check classes in current file
...
...
@@ -7518,6 +7518,8 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN
while
(
base
)
{
if
(
base
->
constant_expressions
.
has
(
p_member
))
{
if
(
r_is_const
)
*
r_is_const
=
true
;
r_member_type
=
base
->
constant_expressions
[
p_member
].
expression
->
get_datatype
();
return
true
;
}
...
...
@@ -7742,8 +7744,9 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
base_type
=
DataType
(
*
p_base_type
);
}
if
(
_get_member_type
(
base_type
,
p_identifier
,
member_type
))
{
if
(
!
p_base_type
&&
current_function
&&
current_function
->
_static
)
{
bool
is_const
=
false
;
if
(
_get_member_type
(
base_type
,
p_identifier
,
member_type
,
&
is_const
))
{
if
(
!
p_base_type
&&
current_function
&&
current_function
->
_static
&&
!
is_const
)
{
_set_error
(
"Can't access member variable (
\"
"
+
p_identifier
.
operator
String
()
+
"
\"
) from a static function."
,
p_line
);
return
DataType
();
}
...
...
modules/gdscript/gdscript_parser.h
View file @
e7f056df
...
...
@@ -635,7 +635,7 @@ private:
DataType
_get_operation_type
(
const
Variant
::
Operator
p_op
,
const
DataType
&
p_a
,
const
DataType
&
p_b
,
bool
&
r_valid
)
const
;
Variant
::
Operator
_get_variant_operation
(
const
OperatorNode
::
Operator
&
p_op
)
const
;
bool
_get_function_signature
(
DataType
&
p_base_type
,
const
StringName
&
p_function
,
DataType
&
r_return_type
,
List
<
DataType
>
&
r_arg_types
,
int
&
r_default_arg_count
,
bool
&
r_static
,
bool
&
r_vararg
)
const
;
bool
_get_member_type
(
const
DataType
&
p_base_type
,
const
StringName
&
p_member
,
DataType
&
r_member_type
)
const
;
bool
_get_member_type
(
const
DataType
&
p_base_type
,
const
StringName
&
p_member
,
DataType
&
r_member_type
,
bool
*
r_is_const
=
nullptr
)
const
;
bool
_is_type_compatible
(
const
DataType
&
p_container
,
const
DataType
&
p_expression
,
bool
p_allow_implicit_conversion
=
false
)
const
;
Node
*
_get_default_value_for_type
(
const
DataType
&
p_type
,
int
p_line
=
-
1
);
...
...
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