diff options
| author | gingerBill <bill@gingerbill.org> | 2019-11-02 16:36:46 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-11-02 16:36:46 +0000 |
| commit | e3d3a81617dd78a9b193bbc07f2a29315774ff57 (patch) | |
| tree | d285fd38b6daae5ac62a8adb10269d31b8f97135 /src/checker.cpp | |
| parent | dbdbbcd60f1273e246d11696476ac4772f91c258 (diff) | |
multivalued procedure calls allows in `for in` to allow a pseudo-iterator; `@thread_local` for variables in procedure
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 8ba45a799..184f99ab9 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -2217,6 +2217,33 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) { } ac->is_static = true; return true; + } else if (name == "thread_local") { + if (ac->init_expr_list_count > 0) { + error(elem, "A thread local variable declaration cannot have initialization values"); + } else if (c->foreign_context.curr_library) { + error(elem, "A foreign block variable cannot be thread local"); + } else if (ac->is_export) { + error(elem, "An exported variable cannot be thread local"); + } else if (ev.kind == ExactValue_Invalid) { + ac->thread_local_model = str_lit("default"); + } else if (ev.kind == ExactValue_String) { + String model = ev.value_string; + if (model == "default" || + model == "localdynamic" || + model == "initialexec" || + model == "localexec") { + ac->thread_local_model = model; + } else { + error(elem, "Invalid thread local model '%.*s'. Valid models:", LIT(model)); + error_line("\tdefault\n"); + error_line("\tlocaldynamic\n"); + error_line("\tinitialexec\n"); + error_line("\tlocalexec\n"); + } + } else { + error(elem, "Expected either no value or a string for '%.*s'", LIT(name)); + } + return true; } if (c->curr_proc_decl != nullptr) { @@ -2257,33 +2284,6 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) { error(elem, "Expected a string value for '%.*s'", LIT(name)); } return true; - } else if (name == "thread_local") { - if (ac->init_expr_list_count > 0) { - error(elem, "A thread local variable declaration cannot have initialization values"); - } else if (c->foreign_context.curr_library) { - error(elem, "A foreign block variable cannot be thread local"); - } else if (ac->is_export) { - error(elem, "An exported variable cannot be thread local"); - } else if (ev.kind == ExactValue_Invalid) { - ac->thread_local_model = str_lit("default"); - } else if (ev.kind == ExactValue_String) { - String model = ev.value_string; - if (model == "default" || - model == "localdynamic" || - model == "initialexec" || - model == "localexec") { - ac->thread_local_model = model; - } else { - error(elem, "Invalid thread local model '%.*s'. Valid models:", LIT(model)); - error_line("\tdefault\n"); - error_line("\tlocaldynamic\n"); - error_line("\tinitialexec\n"); - error_line("\tlocalexec\n"); - } - } else { - error(elem, "Expected either no value or a string for '%.*s'", LIT(name)); - } - return true; } return false; } |