Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KDevelop
KDevelop Python Support
Commits
8a8a1551
Commit
8a8a1551
authored
Oct 25, 2022
by
frmdstryr
Committed by
Sven Brauch
Nov 05, 2022
Browse files
Apply Sven's patch
parent
36564459
Changes
3
Hide whitespace changes
Inline
Side-by-side
parser/ast.cpp
View file @
8a8a1551
...
...
@@ -603,7 +603,7 @@ NumberAst::NumberAst(Ast* parent): ExpressionAst(parent, Ast::NumberAstType), va
QString
NumberAst
::
dump
()
const
{
if
(
isInt
)
return
"Number()"
;
return
QString
::
fromLatin1
(
"Number(%1)"
).
arg
(
value
)
;
else
return
"Float()"
;
}
...
...
@@ -741,6 +741,14 @@ UnaryOperationAst::UnaryOperationAst(Ast* parent): ExpressionAst(parent, Ast::Un
}
QString
UnaryOperationAst
::
dump
()
const
{
QString
r
;
r
.
append
(
"Unary("
);
dumpNode
(
r
,
"value="
,
operand
);
r
.
append
(
")"
);
return
r
;
}
TryAst
::
TryAst
(
Ast
*
parent
)
:
StatementAst
(
parent
,
Ast
::
TryAstType
)
{
...
...
parser/ast.h
View file @
8a8a1551
...
...
@@ -546,6 +546,8 @@ public:
UnaryOperationAst
(
Ast
*
parent
);
Ast
::
UnaryOperatorTypes
type
;
ExpressionAst
*
operand
;
QString
dump
()
const
override
;
};
class
KDEVPYTHONPARSER_EXPORT
LambdaAst
:
public
ExpressionAst
{
...
...
parser/asttransformer.cpp
View file @
8a8a1551
...
...
@@ -374,9 +374,9 @@ Ast* AstTransformer::visitExprNode(PyObject* node, Ast* parent)
v
->
type
=
Ast
::
UnaryOperatorInvalid
;
else
if
(
PyObject_IsInstance
(
node
,
grammar
.
ast_Not
))
v
->
type
=
Ast
::
UnaryOperatorNot
;
else
if
(
PyObject_IsInstance
(
node
,
grammar
.
ast_Add
))
else
if
(
PyObject_IsInstance
(
node
,
grammar
.
ast_
U
Add
))
v
->
type
=
Ast
::
UnaryOperatorAdd
;
else
if
(
PyObject_IsInstance
(
node
,
grammar
.
ast_Sub
))
else
if
(
PyObject_IsInstance
(
node
,
grammar
.
ast_
U
Sub
))
v
->
type
=
Ast
::
UnaryOperatorSub
;
else
v
->
type
=
Ast
::
UnaryOperatorInvalid
;
...
...
@@ -668,7 +668,7 @@ Ast* AstTransformer::visitExprNode(PyObject* node, Ast* parent)
v
->
identifier
->
startCol
=
getattr
<
int
>
(
node
,
"col_offset"
);
v
->
identifier
->
startLine
=
tline
(
getattr
<
int
>
(
node
,
"lineno"
));
v
->
identifier
->
endCol
=
v
->
identifier
->
startCol
+
id
.
size
()
-
1
;
v
->
identifier
->
endLine
=
v
->
identifier
->
end
Line
;
v
->
identifier
->
endLine
=
v
->
identifier
->
start
Line
;
v
->
startCol
=
v
->
identifier
->
startCol
;
v
->
startLine
=
v
->
identifier
->
startLine
;
v
->
endCol
=
v
->
identifier
->
endCol
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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