mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-24 23:35:19 +00:00
Make -strict-style the default #871
This commit is contained in:
@@ -201,7 +201,6 @@ struct BuildContext {
|
||||
bool keep_object_files;
|
||||
bool disallow_do;
|
||||
bool insert_semicolon;
|
||||
bool strict_style;
|
||||
|
||||
bool ignore_warnings;
|
||||
bool warnings_as_errors;
|
||||
|
||||
@@ -1216,8 +1216,8 @@ bool parse_build_flags(Array<String> args) {
|
||||
break;
|
||||
|
||||
case BuildFlag_StrictStyle:
|
||||
build_context.insert_semicolon = true;
|
||||
build_context.strict_style = true;
|
||||
gb_printf_err("-strict-style flag is not required any more\n");
|
||||
bad_flags = true;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1802,10 +1802,6 @@ void print_show_help(String const arg0, String const &command) {
|
||||
print_usage_line(2, "Inserts semicolons on newlines during tokenization using a basic rule");
|
||||
print_usage_line(0, "");
|
||||
|
||||
print_usage_line(1, "-strict-style");
|
||||
print_usage_line(2, "Enforces code style stricter whilst parsing, requiring such things as trailing commas");
|
||||
print_usage_line(0, "");
|
||||
|
||||
print_usage_line(1, "-ignore-warnings");
|
||||
print_usage_line(2, "Ignores warning messages");
|
||||
print_usage_line(0, "");
|
||||
|
||||
@@ -1232,13 +1232,10 @@ void comsume_comment_groups(AstFile *f, Token prev) {
|
||||
}
|
||||
|
||||
bool ignore_newlines(AstFile *f) {
|
||||
if (build_context.strict_style) {
|
||||
if (f->allow_newline) {
|
||||
return f->expr_level > 0;
|
||||
}
|
||||
return f->expr_level >= 0;
|
||||
if (f->allow_newline) {
|
||||
return f->expr_level > 0;
|
||||
}
|
||||
return false;
|
||||
return f->expr_level >= 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1556,7 +1553,7 @@ bool is_semicolon_optional_for_node(AstFile *f, Ast *s) {
|
||||
}
|
||||
|
||||
void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
|
||||
if (build_context.strict_style && token.string == "\n") {
|
||||
if (token.string == "\n") {
|
||||
switch (token.kind) {
|
||||
case Token_CloseBrace:
|
||||
case Token_CloseParen:
|
||||
@@ -4556,9 +4553,7 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) {
|
||||
return ParseFile_WrongExtension;
|
||||
}
|
||||
TokenizerFlags tokenizer_flags = TokenizerFlag_None;
|
||||
if (build_context.insert_semicolon) {
|
||||
tokenizer_flags = TokenizerFlag_InsertSemicolon;
|
||||
}
|
||||
tokenizer_flags = TokenizerFlag_InsertSemicolon;
|
||||
|
||||
zero_item(&f->tokenizer);
|
||||
f->tokenizer.curr_file_id = f->id;
|
||||
|
||||
Reference in New Issue
Block a user