Fix missing field warnings for debugger structs

This commit is contained in:
Max Brunsfeld 2014-10-14 22:50:24 -07:00
parent b468458929
commit b5d022a70c
4 changed files with 25 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#include "runtime/runtime_spec_helper.h"
#include "runtime/debugger.h"
#include "runtime/helpers/spy_debugger.h"
#include "runtime/runtime_spec_helper.h"
extern "C" const TSLanguage * ts_language_json();
@ -114,7 +115,7 @@ describe("Document", [&]() {
describe("disabling debugging", [&]() {
before_each([&]() {
ts_document_debug_parse(doc, {});
ts_document_debug_parse(doc, ts_debugger_null());
});
it("does not call the debugger any more", [&]() {

18
src/runtime/debugger.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef RUNTIME_DEBUGGER_H_
#define RUNTIME_DEBUGGER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "tree_sitter/runtime.h"
static inline TSDebugger ts_debugger_null() {
return (TSDebugger) { .data = NULL, .debug_fn = NULL, .release_fn = NULL, };
}
#ifdef __cplusplus
}
#endif
#endif // RUNTIME_DEBUGGER_H_

View file

@ -2,6 +2,7 @@
#include "tree_sitter/parser.h"
#include "runtime/tree.h"
#include "runtime/length.h"
#include "runtime/debugger.h"
#include "utf8proc.h"
static const char *empty_chunk = "";
@ -69,7 +70,7 @@ static TSTree *accept(TSLexer *lexer, TSSymbol symbol, int is_hidden) {
TSLexer ts_lexer_make() {
TSLexer result = (TSLexer) { .advance_fn = advance,
.accept_fn = accept,
.debugger = {},
.debugger = ts_debugger_null(),
.chunk = NULL,
.chunk_start = 0,
.chunk_size = 0,

View file

@ -7,6 +7,7 @@
#include "runtime/stack.h"
#include "runtime/parser.h"
#include "runtime/length.h"
#include "runtime/debugger.h"
/*
* Debugging
@ -283,7 +284,7 @@ TSParser ts_parser_make() {
return (TSParser) { .lexer = ts_lexer_make(),
.stack = ts_stack_make(),
.right_stack = ts_stack_make(),
.debugger = (TSDebugger) {} };
.debugger = ts_debugger_null() };
}
void ts_parser_destroy(TSParser *parser) {