// 添加结构体数据 private void AddStructData(ALittleScriptStructDecElement dec) { var name_dec = dec.GetStructNameDec(); if (name_dec == null) { return; } if (!m_struct_data_map.TryGetValue(dec.GetFile(), out Dictionary <string, ALittleScriptStructData> map)) { map = new Dictionary <string, ALittleScriptStructData>(); m_struct_data_map.Add(dec.GetFile(), map); } var struct_data = new ALittleScriptStructData(); string name = name_dec.GetElementText(); if (map.ContainsKey(name)) { map.Remove(name); } map.Add(name, struct_data); var body_dec = dec.GetStructBodyDec(); if (body_dec == null) { return; } var var_dec_list = body_dec.GetStructVarDecList(); foreach (var var_dec in var_dec_list) { struct_data.AddVarDec(var_dec); } }
// 获取结构体数据 public ALittleScriptStructData GetStructData(ALittleScriptStructDecElement dec) { var name_dec = dec.GetStructNameDec(); if (name_dec == null) { return(null); } if (!m_struct_data_map.TryGetValue(dec.GetFile(), out Dictionary <string, ALittleScriptStructData> map)) { return(null); } if (!map.TryGetValue(name_dec.GetElementText(), out ALittleScriptStructData data)) { return(null); } return(data); }