Skip to content

Commit a5be19f

Browse files
usiemsjcfr
authored andcommitted
[Backport generator] Keep track of current source code in Debug mode,
also fixed some warnings (cherry picked from commit MeVisLab/pythonqt@5f3bd64)
1 parent 9ff8463 commit a5be19f

File tree

5 files changed

+202
-185
lines changed

5 files changed

+202
-185
lines changed

generator/parser/ast.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ QString AST::toString(TokenStream *stream) const
4848
{
4949
const Token &tk = stream->token((int) start_token);
5050
const Token &end_tk = stream->token ((int) end_token);
51-
return QString::fromLatin1(tk.text + tk.position, end_tk.position - tk.position);
51+
return QString::fromLatin1(tk.text + tk.position, static_cast<int>(end_tk.position - tk.position));
5252
}

generator/parser/binder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ void Binder::visitQEnums(QEnumsAST *node)
817817
const Token &start = _M_token_stream->token((int) node->start_token);
818818
const Token &end = _M_token_stream->token((int) node->end_token);
819819
QStringList enum_list = QString::fromLatin1(start.text + start.position,
820-
end.position - start.position).split(' ');
820+
static_cast<int>(end.position - start.position)).split(' ');
821821

822822
ScopeModelItem scope = currentScope();
823823
for (int i = 0; i < enum_list.size(); ++i) {
@@ -833,7 +833,7 @@ void Binder::visitQProperty(QPropertyAST *node)
833833
const Token &start = _M_token_stream->token((int) node->start_token);
834834
const Token &end = _M_token_stream->token((int) node->end_token);
835835
QString property = QString::fromLatin1(start.text + start.position,
836-
end.position - start.position);
836+
static_cast<int>(end.position - start.position));
837837
_M_current_class->addPropertyDeclaration(property);
838838
}
839839

generator/parser/lexer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ class TokenStream
168168
inline std::size_t matchingBrace(std::size_t i) const
169169
{ return tokens[i].extra.right_brace; }
170170

171-
inline Token &operator[](int i)
171+
inline Token &operator[](std::size_t i)
172172
{ return tokens[i]; }
173173

174-
inline const Token &token(int i) const
174+
inline const Token &token(std::size_t i) const
175175
{ return tokens[i]; }
176176

177177
private:

0 commit comments

Comments
 (0)