void l_variables_context::must_to_be_global_value(l_function* fun, l_syntactic_tree::variable_node* variable_node) { //not dec? if(!is_declared(fun,variable_node)) add_variable_into_table(fun, variable_node); //.. m_funs_table[fun][ variable_index(variable_node->m_name) ].m_context_type = const_info::T_CTX_MUST_TO_BE_GLOBAL; }
//push variable void l_variables_context::add_variable_into_table(l_function* f_context, l_syntactic_tree::variable_node* var_value) { //function map context auto& f_table = m_funs_table[f_context]; //index std::string key = variable_index(var_value); //find name if(f_table.find(key) == f_table.end()) { f_table[key] = const_info(m_gc, get_new_id(f_context), var_value ); } }
//isn't an up value void l_variables_context::is_not_upper_value(l_function* fun, l_syntactic_tree::variable_node* variable_node) { //not dec? if(!is_declared(fun,variable_node)) add_variable_into_table(fun, variable_node); //get ref auto& context_type = m_funs_table[fun][ variable_index(variable_node->m_name) ].m_context_type; //if can change value if( context_type == const_info::T_CTX_CAN_TO_BE_UPPER) { context_type = const_info::T_CTX_CAN_NOT_TO_BE_UPPER; } }
bool l_variables_context::is_global_value(l_function* f_context,l_syntactic_tree::variable_node* node) { //function map context auto& f_table = m_funs_table[f_context]; //find name auto id_const = f_table.find(variable_index(node)); //find name if( id_const != f_table.end() ) { return id_const->second.m_context_type == const_info::T_CTX_MUST_TO_BE_GLOBAL; } return false; }
/* * Copyright (C) 2010-2015 Alibaba Group Holding Limited */ #include "ngx_http_reqstat.h" static variable_index_t REQSTAT_RSRV_VARIABLES[NGX_HTTP_REQSTAT_RSRV] = { variable_index("bytes_in", 0), variable_index("bytes_out", 1), variable_index("conn_total", 2), variable_index("req_total", 3), variable_index("http_2xx", 4), variable_index("http_3xx", 5), variable_index("http_4xx", 6), variable_index("http_5xx", 7), variable_index("http_other_status", 8), variable_index("rt", 9), variable_index("ups_req", 10), variable_index("ups_rt", 11), variable_index("ups_tries", 12), variable_index("http_200", 13), variable_index("http_206", 14), variable_index("http_302", 15), variable_index("http_304", 16), variable_index("http_403", 17), variable_index("http_404", 18), variable_index("http_416", 19), variable_index("http_499", 20), variable_index("http_500", 21),
//get int l_variables_context::get_var_id(l_function* f_context,l_syntactic_tree::variable_node* node) { return get_table_id(f_context,variable_index(node)); }
//is dec? bool l_variables_context::is_declared(l_function* fun, l_syntactic_tree::variable_node* variable_node) { auto& fun_table = m_funs_table[fun]; auto it = fun_table.find(variable_index(variable_node->m_name)); return it != fun_table.end(); }