Skip to content

Commit f859ba7

Browse files
Update static analyzer
* Rework tracking of source code coordinates in compiler * Fix diagnostics * Remove never worked warnings * Remove unused variable states * Organize, extend and clean up tests * Improve diagnostic messages Also * Make test runner multithreaded * Bump version to 4.13.7
1 parent b73102b commit f859ba7

247 files changed

Lines changed: 1964 additions & 1882 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/squirrel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace SQCompilation
7878

7979
#define SQUIRREL_VERSION_NUMBER_MAJOR 4
8080
#define SQUIRREL_VERSION_NUMBER_MINOR 13
81-
#define SQUIRREL_VERSION_NUMBER_PATCH 0
81+
#define SQUIRREL_VERSION_NUMBER_PATCH 7
8282

8383
#define SQ_STRINGIFY_HELPER(x) #x
8484
#define SQ_STRINGIFY(x) SQ_STRINGIFY_HELPER(x)

squirrel/ast_tools/ast_indent_render.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ class IndentedTreeRenderer : public Visitor {
243243
++_indent;
244244
writeIndentedFmtString("Left\n");
245245
++_indent;
246-
expr->_lhs->visit(this);
246+
expr->lhs()->visit(this);
247247
--_indent;
248248
writeIndentedFmtString("Right\n");
249249
++_indent;
250-
expr->_rhs->visit(this);
250+
expr->rhs()->visit(this);
251251
--_indent;
252252
--_indent;
253253
break;

squirrel/compiler/arena.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,27 @@ class ArenaVector {
229229
public:
230230
using size_type = uint32_t;
231231

232-
ArenaVector(Arena *arena) :
233-
_arena(arena),
234-
_vals(NULL),
235-
_size(0),
236-
_allocated(0) {
232+
ArenaVector(Arena *arena)
233+
: _arena(arena)
234+
, _vals(NULL)
235+
, _size(0)
236+
, _allocated(0)
237+
{
238+
}
237239

240+
// Implement if needed
241+
ArenaVector(const ArenaVector&) = delete;
242+
ArenaVector& operator=(const ArenaVector&) = delete;
243+
244+
ArenaVector(ArenaVector&& other) noexcept
245+
: _arena(other._arena)
246+
, _vals(other._vals)
247+
, _size(other._size)
248+
, _allocated(other._allocated)
249+
{
250+
other._vals = nullptr;
251+
other._size = 0;
252+
other._allocated = 0;
238253
}
239254

240255
inline T &push_back(const T& val = T())

squirrel/compiler/ast.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ void IncExpr::transformChildren(Transformer *transformer) {
321321
_arg = _arg->transform(transformer)->asExpression();
322322
}
323323

324+
DeclExpr::DeclExpr(Decl *decl) : Expr(TO_DECL_EXPR, decl->sourceSpan()), _decl(decl) {}
325+
324326
void DeclExpr::visitChildren(Visitor *visitor) { _decl->visit(visitor); }
325327

326328
void DeclExpr::transformChildren(Transformer *transformer) {
@@ -411,7 +413,11 @@ void FunctionDecl::transformChildren(Transformer *transformer) {
411413
setBody(body()->transform(transformer)->asStatement()->asBlock());
412414
}
413415

414-
void FunctionDecl::setBody(Block *body) { _body = body; body->setIsBody(); }
416+
void FunctionDecl::setBody(Block *body) {
417+
_body = body;
418+
body->setIsBody();
419+
setSpanEnd(body->sourceSpan().end);
420+
}
415421

416422
void ConstDecl::visitChildren(Visitor *visitor) {
417423
_value->visit(visitor);
@@ -422,7 +428,6 @@ void ConstDecl::transformChildren(Transformer *transformer) {
422428
}
423429

424430
void DeclGroup::visitChildren(Visitor *visitor) {
425-
426431
for (auto decl : declarations())
427432
decl->visit(visitor);
428433
}

0 commit comments

Comments
 (0)