MCPcopy Create free account
hub / github.com/covscript/covscript / check_declar_var

Method check_declar_var

sources/instance/instance.cpp:193–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 }
192
193 void instance_type::check_declar_var(tree_type<token_base *>::iterator it, bool regist)
194 {
195 if (it.data() == nullptr)
196 throw internal_error("Null pointer accessed.");
197 if (it.data()->get_type() == token_types::parallel) {
198 auto &parallel_list = static_cast<token_parallel *>(it.data())->get_parallel();
199 for (auto &t : parallel_list)
200 check_declar_var(t.root(), regist);
201 }
202 else {
203 token_base *root = it.data();
204 if (root == nullptr || root->get_type() != token_types::id)
205 throw runtime_error("Wrong grammar for variable declaration.");
206 if (regist)
207 storage.add_record(static_cast<token_id *>(root)->get_id().get_id());
208 }
209 }
210
211 void instance_type::check_define_var(tree_type<token_base *>::iterator it, bool regist, bool constant)
212 {

Callers 1

trim_exprMethod · 0.80

Calls 5

internal_errorClass · 0.85
runtime_errorClass · 0.85
dataMethod · 0.80
get_typeMethod · 0.45
rootMethod · 0.45

Tested by

no test coverage detected