private void VisitNamespaceEventDefinition(common_namespace_event _event) { if (is_interface) SavePositionAndConstPool(_event); else SavePositionAndImplementationPool(_event); bw.Write((byte)_event.semantic_node_type); bw.Write(is_interface); if (is_interface == true) bw.Write(GetNameIndex(_event)); else bw.Write(_event.name); WriteTypeReference(_event.delegate_type); if (CanWriteObject(_event.add_method)) bw.Write(GetMemberOffset(_event.add_method)); if (CanWriteObject(_event.remove_method)) bw.Write(GetMemberOffset(_event.remove_method)); if (CanWriteObject(_event.raise_method)) bw.Write(GetMemberOffset(_event.raise_method)); bw.Write(GetMemberOffset(_event.field)); bw.Write(GetUnitReference(_event.namespace_node)); WriteDebugInfo(_event.loc); }
public common_namespace_event GetNamespaceEvent(int offset) { definition_node dn = null; if (members.TryGetValue(offset, out dn)) return dn as common_namespace_event; common_namespace_event cne = null; int pos = (int)br.BaseStream.Position; br.BaseStream.Seek(start_pos + offset, SeekOrigin.Begin); br.ReadByte(); string name; bool is_interface = br.ReadBoolean(); if (is_interface)//пропускаем флаг - интерфейсности { name = GetString(br.ReadInt32()); } else { name = br.ReadString(); } cne = new common_namespace_event(name, null, cun.namespaces[0], null, null, null, null); cne.set_event_type(GetTypeReference()); if (CanReadObject()) cne.set_add_function(GetNamespaceFunction(br.ReadInt32())); if (CanReadObject()) cne.set_remove_function(GetNamespaceFunction(br.ReadInt32())); if (CanReadObject()) cne.set_raise_function(GetNamespaceFunction(br.ReadInt32())); cne.field = GetNamespaceVariable(br.ReadInt32()); br.ReadInt32(); cne.loc = ReadDebugInfo(); AddMember(cne, offset); if (is_interface) { cne.namespace_node = cun.namespaces[0]; int_members.Add(cne); } else { cne.namespace_node = cun.namespaces[1]; impl_members.Add(cne); } br.BaseStream.Seek(pos, SeekOrigin.Begin); return cne; }
public SymbolInfo(common_namespace_event value) { _sym_info = value; _access_level = access_level.al_public; _symbol_kind = symbol_kind.sk_none; }
private common_namespace_event CreateInterfaceNamespaceEvent(string name, int offset) { definition_node dn = null; if (members.TryGetValue(offset, out dn)) return dn as common_namespace_event; common_namespace_event cne = null; cne = new common_namespace_event(name, null, cun.namespaces[0], null, null, null, null); br.ReadBoolean(); br.ReadInt32(); cne.set_event_type(GetTypeReference()); if (CanReadObject()) cne.set_add_function(GetNamespaceFunction(br.ReadInt32())); if (CanReadObject()) cne.set_remove_function(GetNamespaceFunction(br.ReadInt32())); if (CanReadObject()) cne.set_raise_function(GetNamespaceFunction(br.ReadInt32())); cne.field = GetNamespaceVariable(br.ReadInt32()); br.ReadInt32(); cne.loc = ReadDebugInfo(); AddMember(cne, offset); int_members.Add(cne); return cne; }
public common_namespace_event add_namespace_event(string name, location loc, type_node tn) { namespace_variable nv = new namespace_variable(name + "$", tn, converted_namespace, loc); common_namespace_event cne = new common_namespace_event(name, tn, converted_namespace, null, null, null, loc); common_namespace_function_node add_func = new common_namespace_function_node(compiler_string_consts.GetAddHandler(name), null, this.converted_namespace, null); common_parameter cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_func, concrete_parameter_type.cpt_none, null, null); add_func.parameters.AddElement(cp); expression_node fld_ref = null; fld_ref = new namespace_variable_reference(nv, null); expression_node en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_add_assign_compile_time_executor (null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) }); //en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(compiler_string_consts.assign_name).sym_info as function_node,null, // fld_ref,en); add_func.function_code = new statements_list(null); (add_func.function_code as statements_list).statements.AddElement(en); //remove common_namespace_function_node remove_func = new common_namespace_function_node(compiler_string_consts.GetRemoveHandler(name), null, this.converted_namespace, null); cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_func, concrete_parameter_type.cpt_none, null, null); remove_func.parameters.AddElement(cp); en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_sub_assign_compile_time_executor (null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) }); //en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(compiler_string_consts.assign_name).sym_info as function_node,null, // fld_ref,en); remove_func.function_code = new statements_list(null); (remove_func.function_code as statements_list).statements.AddElement(en); this.converted_namespace.functions.AddElement(add_func); this.converted_namespace.functions.AddElement(remove_func); cne.set_add_function(add_func); cne.set_remove_function(remove_func); cne.field = nv; this.converted_namespace.events.AddElement(cne); this.converted_namespace.variables.AddElement(nv); CurrentScope.AddSymbol(name, new SymbolInfo(cne)); return cne; }