private void SaveFunction(common_namespace_function_node cfn) { if (!string.IsNullOrEmpty(cfn.documentation)) { if (!cfn.documentation.Trim(' ', '\t').StartsWith("<summary>")) { xtw.WriteStartElement("member"); xtw.WriteStartAttribute("name"); xtw.WriteString("M:" + (is_assembly?unit_name + "." + unit_name + ".":"") + cfn.name + GetGenericFlag(cfn) + GetParameters(cfn)); xtw.WriteEndAttribute(); xtw.WriteStartElement("summary"); xtw.WriteString(cfn.documentation); xtw.WriteEndElement(); xtw.WriteEndElement(); } else { string doc = string.Concat("<member name=\"" + "M:" + (is_assembly?unit_name + "." + unit_name + ".":"") + cfn.name + GetGenericFlag(cfn) + GetParameters(cfn) + "\">", cfn.documentation, "</member>"); StringReader sr = new StringReader(doc); XmlReader xr = XmlTextReader.Create(sr); xr.Read(); xtw.WriteNode(xr.ReadSubtree(), false); sr.Close(); xr.Close(); } } }
/// <summary> /// Временный узел, который используется при выведении типов параметров /// </summary> /// <param name="def"></param> /// <param name="visitor"></param> /// <returns></returns> public static typed_expression GetTempFunctionNodeForTypeInference(SyntaxTree.function_lambda_definition def, syntax_tree_visitor visitor) { var res = new common_namespace_function_node(def.lambda_name, visitor.get_location(def), null, null); if (def.return_type != null) { res.return_value_type = visitor.convert_strong(def.return_type); } else { res.return_value_type = null; } res.parameters.clear(); if (def.formal_parameters != null && def.formal_parameters.params_list.Count != 0) { for (int i = 0; i < def.formal_parameters.params_list.Count; i++) { var tt = visitor.convert_strong(def.formal_parameters.params_list[i].vars_type); // SSM 29/12/18 for (int j = 0; j < def.formal_parameters.params_list[i].idents.idents.Count; j++) { var new_param = new common_parameter(null, SemanticTree.parameter_type.value, res, concrete_parameter_type.cpt_none, visitor.get_location(def.formal_parameters.params_list[i].idents.idents[0])); new_param.type = tt; res.parameters.AddElement(new_param); } } } var hhh = new delegated_methods(); hhh.proper_methods.AddElement(new common_namespace_function_call(res, visitor.get_location(def))); return(new typed_expression(hhh, visitor.get_location(def))); }
public SymbolInfo(common_namespace_function_node value) { //_name_information_type=name_information_type.nit_common_namespace_function; _sym_info = value; _access_level = access_level.al_public; _symbol_kind = get_function_kind(value); }
public common_unit_node(SymbolTable.UnitInterfaceScope scope, SymbolTable.UnitImplementationScope implementation_scope, common_namespace_function_node main_function, common_namespace_function_node finalization_method) { _scope = scope; _implementation_scope = implementation_scope; _main_function = main_function; _finalization_method = finalization_method; }
public common_unit_node(PascalSharp.Internal.TreeConverter.SymbolTable.UnitInterfaceScope scope, PascalSharp.Internal.TreeConverter.SymbolTable.UnitImplementationScope implementation_scope, common_namespace_function_node main_function, common_namespace_function_node finalization_method) { _scope = scope; _implementation_scope = implementation_scope; _main_function = main_function; _finalization_method = finalization_method; }
public common_namespace_event(string name, type_node del_type, common_namespace_node cont_namespace, common_namespace_function_node add_function, common_namespace_function_node remove_function, common_namespace_function_node raise_function, location loc) { this._name = name; this.del_type = del_type; this._add_function = add_function; this._remove_function = remove_function; this._raise_function = raise_function; this._cont_namespace = cont_namespace; this._loc = loc; }
public void create_main_function_as_in_module() { add_needed_cctors(); statements_list sl = new statements_list(loc); statements_list intern_sl = new statements_list(loc); statements_list sl2 = sl; sl = new statements_list(null); common_namespace_function_node init_func = new common_namespace_function_node("$_Init_", null, null, common_namespaces[0], null); common_namespaces[0].functions.AddElement(init_func); namespace_variable init_var = new namespace_variable("$is_init", SystemLibrary.SystemLibrary.bool_type, common_namespaces[0], null); common_namespaces[0].variables.AddElement(init_var); for (int i = 0; i < units.Count; i++) { if (units[i].main_function != null) { common_namespace_function_call cnfc = new common_namespace_function_call(units[i].main_function, loc); sl.statements.AddElement(cnfc); } } /*for (int i = units.Count - 1; i >= 0; i--) * { * if (units[i].finalization_method != null) * { * common_namespace_function_call cnfc = new common_namespace_function_call(units[i].finalization_method, loc); * sl.statements.AddElement(cnfc); * } * }*/ sl2 = new statements_list(loc); basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_assign as basic_function_node, null); bfc.parameters.AddElement(new namespace_variable_reference(init_var, null)); bfc.parameters.AddElement(new bool_const_node(true, null)); sl.statements.AddElementFirst(bfc); bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node, null); bfc.parameters.AddElement(new namespace_variable_reference(init_var, null)); sl2.statements.AddElement(new if_node(bfc, sl, null, null)); init_func.function_code = sl2; _init_code = new common_namespace_function_call(init_func, null); add_initialization_to_cctors(); }
/// <summary> /// Конструктор корневого узла dll. /// </summary> /// <param name="initialization_function">Метод инициализации dll.</param> /// <param name="finalization_function">Метод финализации dll.</param> /// <param name="loc">Расположение заголовка главного unit-а dll.</param> public dll_node(common_namespace_function_node initialization_function, common_namespace_function_node finalization_function, location loc) : base(loc) { _initialization_function = initialization_function; _finalization_function = finalization_function; }
public void create_main_function(string[] used_stand_modules, Dictionary <string, object> config) { add_needed_cctors(); common_namespace_function_node temp = _main_function; _main_function = new common_namespace_function_node("Main", null, null, (common_namespace_node)_main_function.comprehensive_namespace, null); location loc = temp.loc; statements_list sl = new statements_list(loc); _main_function.function_code = sl; // if (units[0].MainArgsParameter!=null) // { // _main_function.parameters.AddElement(units[0].MainArgsParameter); // sl.statements.AddElement(units[0].MainArgsAssignExpr); // } // if (units[0].IsConsoleApplicationVariableAssignExpr!=null) // { // sl.statements.AddElement(units[0].IsConsoleApplicationVariableAssignExpr); // } statements_list sl2 = sl; sl = new statements_list(null); common_namespace_function_node init_func = new common_namespace_function_node("$_Init_", null, null, (common_namespace_node)_main_function.comprehensive_namespace, null); ((common_namespace_node)_main_function.comprehensive_namespace).functions.AddElement(init_func); namespace_variable init_var = new namespace_variable("$is_init", SystemLibrary.SystemLibrary.bool_type, (common_namespace_node)_main_function.comprehensive_namespace, null); ((common_namespace_node)_main_function.comprehensive_namespace).variables.AddElement(init_var); if (SystemLibrary.SystemLibInitializer.ConfigVariable != null && SystemLibrary.SystemLibInitializer.ConfigVariable.Found) { namespace_variable conf_nv = null; compiled_variable_definition conf_cf = null; if (SystemLibrary.SystemLibInitializer.ConfigVariable.sym_info is namespace_variable) { conf_nv = SystemLibrary.SystemLibInitializer.ConfigVariable.sym_info as namespace_variable; } else { conf_cf = SystemLibrary.SystemLibInitializer.ConfigVariable.sym_info as compiled_variable_definition; } foreach (string config_var in config.Keys) { var config_value = config[config_var]; compiled_function_call cfc = new compiled_function_call(compiled_function_node.get_compiled_method(NetHelper.NetHelper.AddToDictionaryMethod), (conf_nv != null) ? (expression_node) new namespace_variable_reference(conf_nv, null) : (expression_node) new static_compiled_variable_reference(conf_cf, null), null); cfc.parameters.AddElement(new string_const_node(config_var, null)); switch (Type.GetTypeCode(config_value.GetType())) { case TypeCode.String: cfc.parameters.AddElement(new string_const_node((string)config_value, null)); break; case TypeCode.Int32: cfc.parameters.AddElement(new int_const_node((int)config_value, null)); break; case TypeCode.Boolean: cfc.parameters.AddElement(new bool_const_node((bool)config_value, null)); break; case TypeCode.Double: cfc.parameters.AddElement(new double_const_node((double)config_value, null)); break; default: throw new NotSupportedException("Config value type is nort supported"); } sl.statements.AddElement(cfc); } } if (units[0].MainArgsParameter != null) { _main_function.parameters.AddElement(units[0].MainArgsParameter); sl.statements.AddElementFirst(units[0].MainArgsAssignExpr); } if (units[0].IsConsoleApplicationVariableAssignExpr != null) { sl.statements.AddElementFirst(units[0].IsConsoleApplicationVariableAssignExpr); } for (int i = 0; i < units.Count; i++) { if (units[i].main_function != null) { if (units[i].main_function.name != TreeConverter.compiler_string_consts.temp_main_function_name) { common_namespace_function_call cnfc = new common_namespace_function_call(units[i].main_function, loc); sl.statements.AddElement(cnfc); } else { common_namespace_function_call cnfc = new common_namespace_function_call(units[i].main_function, loc); sl2.statements.AddElement(cnfc); } } } //if (units.Count == 1) for (int i = 0; i < used_stand_modules.Length; i++) { Type t = NetHelper.NetHelper.FindRtlType(used_stand_modules[i] + "." + used_stand_modules[i]); if (t == null) { continue; } compiled_type_node ctn = compiled_type_node.get_type_node(t); System.Reflection.MethodInfo mi = ctn.compiled_type.GetMethod("__InitModule__"); if (mi == null) { continue; } compiled_static_method_call csmc = new compiled_static_method_call(compiled_function_node.get_compiled_method(mi), null); sl.statements.AddElement(csmc); } for (int i = units.Count - 1; i >= 0; i--) { if (units[i].finalization_method != null) { common_namespace_function_call cnfc = new common_namespace_function_call(units[i].finalization_method, loc); sl2.statements.AddElement(cnfc); } } //if (units.Count == 1) for (int i = 0; i < used_stand_modules.Length; i++) { Type t = NetHelper.NetHelper.FindRtlType(used_stand_modules[i] + "." + used_stand_modules[i]); if (t == null) { continue; } compiled_type_node ctn = compiled_type_node.get_type_node(t); System.Reflection.MethodInfo mi = ctn.compiled_type.GetMethod("__FinalizeModule__"); if (mi == null) { continue; } compiled_static_method_call csmc = new compiled_static_method_call(compiled_function_node.get_compiled_method(mi), null); sl2.statements.AddElement(csmc); } sl2 = new statements_list(loc); basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_assign as basic_function_node, null); bfc.parameters.AddElement(new namespace_variable_reference(init_var, null)); bfc.parameters.AddElement(new bool_const_node(true, null)); sl.statements.AddElementFirst(bfc); bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node, null); bfc.parameters.AddElement(new namespace_variable_reference(init_var, null)); sl2.statements.AddElement(new if_node(bfc, sl, null, null)); init_func.function_code = sl2; sl = new statements_list(null); sl.statements.AddElement(new common_namespace_function_call(init_func, null)); common_namespace_function_node init_variables_func = new common_namespace_function_node("$_InitVariables_", null, null, (common_namespace_node)_main_function.comprehensive_namespace, null); init_variables_func.function_code = new statements_list(null); ((common_namespace_node)_main_function.comprehensive_namespace).functions.AddElement(init_variables_func); sl.statements.AddElement(new common_namespace_function_call(init_variables_func, null)); _init_code = sl; }
/// <summary> /// Конструктор класса. /// </summary> /// <param name="main_function">Главная функция программы.</param> /// <param name="loc">Расположение программы.</param> public program_node(common_namespace_function_node main_function, location loc) : base(loc) { _main_function = main_function; }
private void init_temp_methods(SymbolTable.Scope sc) { //TODO: Сделано по быстрому. Переделать. Type tp=typeof(Console); compiled_function_node cfn; System.Type[] arr=new System.Type[1]; System.Reflection.MethodInfo mi; arr[0]=typeof(int); mi=tp.GetMethod("WriteLine",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_integer_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("writeln",new SymbolInfo(cfn)); arr[0]=typeof(double); mi=tp.GetMethod("WriteLine",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_real_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("writeln",new SymbolInfo(cfn)); arr[0]=typeof(char); mi=tp.GetMethod("WriteLine",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_char_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("writeln",new SymbolInfo(cfn)); arr[0]=typeof(bool); mi=tp.GetMethod("WriteLine",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_bool_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("writeln",new SymbolInfo(cfn)); arr[0]=typeof(string); mi=tp.GetMethod("WriteLine",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("writeln",new SymbolInfo(cfn)); mi=tp.GetMethod("ReadLine",new System.Type[0]); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.return_value_type=_string_type; sc.AddSymbol("readline",new SymbolInfo(cfn)); make_assign_operator(_string_type,SemanticTree.basic_function_type.objassign); tp=typeof(int); arr[0]=typeof(string); mi=tp.GetMethod("Parse",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null)); cfn.return_value_type=_integer_type; sc.AddSymbol("parseint",new SymbolInfo(cfn)); tp=typeof(double); arr[0]=typeof(string); mi=tp.GetMethod("Parse",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null)); cfn.return_value_type=_real_type; sc.AddSymbol("parsereal",new SymbolInfo(cfn)); tp=typeof(bool); arr[0]=typeof(string); mi=tp.GetMethod("Parse",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null)); cfn.return_value_type=_bool_type; sc.AddSymbol("parsebool",new SymbolInfo(cfn)); tp=typeof(char); arr[0]=typeof(string); mi=tp.GetMethod("Parse",arr); cfn=new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null)); cfn.return_value_type=_char_type; sc.AddSymbol("parsechar",new SymbolInfo(cfn)); common_namespace_function_node cnfn = new common_namespace_function_node("New",null); cnfn.parameters.Clear(); cnfn.parameters.Add(new common_parameter("ptr",_pointer_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("new",new SymbolInfo(cnfn)); cnfn = new common_namespace_function_node("Dispose",null); cnfn.parameters.Clear(); cnfn.parameters.Add(new common_parameter("ptr",_pointer_type,SemanticTree.parameter_type.value,null)); sc.AddSymbol("dispose",new SymbolInfo(cnfn)); }
private void VisitCommonNamespaceFunctionNode(common_namespace_function_node cnfn) { if (extended_mode) { VisitVariables(cnfn.var_definition_nodes_list); } foreach (var_definition_node vdn in cnfn.var_definition_nodes_list) { helper.AddVariable(vdn); } foreach (common_parameter prm in cnfn.parameters) { helper.AddParameter(prm); } foreach (common_in_function_function_node nested in cnfn.functions_nodes_list) { VisitNestedFunction(nested); } cur_func = cnfn; VisitStatement(cnfn.function_code); foreach (var_definition_node vdn2 in cnfn.var_definition_nodes_list) { if (vdn2 is local_variable) { local_variable vdn = vdn2 as local_variable; VarInfo vi = helper.GetVariable(vdn); if (vi.num_use == 0 && !vdn.is_special_name) { warns.Add(new UnusedVariable(vdn.name, vdn.loc)); } else if (vi.num_ass == 0 && vdn.is_ret_value && !cnfn.name.StartsWith("<") && cnfn.return_value_type != null && cnfn.return_value_type.type_special_kind != SemanticTree.type_special_kind.record && !cnfn.return_value_type.IsPointer && cnfn.return_value_type.type_special_kind != SemanticTree.type_special_kind.array_wrapper && !helper.IsExternal(cnfn)) { warns.Add(new UndefinedReturnValue(cnfn.name, cnfn.function_code.location)); } if (vi.num_ass > 0 && vi.act_num_use == 0 && !vdn.is_special_name) { warns.Add(new AssignWithoutUsing(vdn.name, vi.last_ass_loc)); } } else if (vdn2 is local_block_variable) { local_block_variable vdn = vdn2 as local_block_variable; VarInfo vi = helper.GetVariable(vdn); if (vi.num_use == 0 && !vdn.is_special_name) { warns.Add(new UnusedVariable(vdn.name, vdn.loc)); } else if (vi.num_ass == 0 && vdn.is_ret_value && !cnfn.name.StartsWith("<") && cnfn.return_value_type != null && cnfn.return_value_type.type_special_kind != SemanticTree.type_special_kind.record && !cnfn.return_value_type.IsPointer && cnfn.return_value_type.type_special_kind != SemanticTree.type_special_kind.array_wrapper && !helper.IsExternal(cnfn)) { warns.Add(new UndefinedReturnValue(cnfn.name, cnfn.function_code.location)); } if (vi.num_ass > 0 && vi.act_num_use == 0 && !vdn.is_special_name) { warns.Add(new AssignWithoutUsing(vdn.name, vi.last_ass_loc)); } } if (vdn2.inital_value != null) { VisitExpression(vdn2.inital_value); } } foreach (common_parameter prm in cnfn.parameters) { ParamInfo vi = helper.GetParameter(prm); if (prm.inital_value != null) { VisitExpression(prm.inital_value); } //if (vi.num_use == 0 && !prm.name.Contains("$")) warns.Add(new UnusedParameter(prm.name, prm.loc)); } foreach (var_definition_node vdn in cnfn.var_definition_nodes_list) { VarInfo vi = helper.GetVariable(vdn); if (vdn.inital_value != null) { VisitExpression(vdn.inital_value); } } }
private void init_temp_methods(SymbolTable.Scope sc) { //TODO: Сделано по быстрому. Переделать. Type tp = typeof(Console); compiled_function_node cfn; System.Type[] arr = new System.Type[1]; System.Reflection.MethodInfo mi; arr[0] = typeof(int); mi = tp.GetMethod("WriteLine", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _integer_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("writeln", new SymbolInfo(cfn)); arr[0] = typeof(double); mi = tp.GetMethod("WriteLine", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _real_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("writeln", new SymbolInfo(cfn)); arr[0] = typeof(char); mi = tp.GetMethod("WriteLine", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _char_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("writeln", new SymbolInfo(cfn)); arr[0] = typeof(bool); mi = tp.GetMethod("WriteLine", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _bool_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("writeln", new SymbolInfo(cfn)); arr[0] = typeof(string); mi = tp.GetMethod("WriteLine", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _string_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("writeln", new SymbolInfo(cfn)); mi = tp.GetMethod("ReadLine", new System.Type[0]); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.return_value_type = _string_type; sc.AddSymbol("readline", new SymbolInfo(cfn)); make_assign_operator(_string_type, SemanticTree.basic_function_type.objassign); tp = typeof(int); arr[0] = typeof(string); mi = tp.GetMethod("Parse", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _string_type, SemanticTree.parameter_type.value, null)); cfn.return_value_type = _integer_type; sc.AddSymbol("parseint", new SymbolInfo(cfn)); tp = typeof(double); arr[0] = typeof(string); mi = tp.GetMethod("Parse", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _string_type, SemanticTree.parameter_type.value, null)); cfn.return_value_type = _real_type; sc.AddSymbol("parsereal", new SymbolInfo(cfn)); tp = typeof(bool); arr[0] = typeof(string); mi = tp.GetMethod("Parse", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _string_type, SemanticTree.parameter_type.value, null)); cfn.return_value_type = _bool_type; sc.AddSymbol("parsebool", new SymbolInfo(cfn)); tp = typeof(char); arr[0] = typeof(string); mi = tp.GetMethod("Parse", arr); cfn = new compiled_function_node(mi); cfn.parameters.Clear(); cfn.parameters.Add(new common_parameter("val", _string_type, SemanticTree.parameter_type.value, null)); cfn.return_value_type = _char_type; sc.AddSymbol("parsechar", new SymbolInfo(cfn)); common_namespace_function_node cnfn = new common_namespace_function_node("New", null); cnfn.parameters.Clear(); cnfn.parameters.Add(new common_parameter("ptr", _pointer_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("new", new SymbolInfo(cnfn)); cnfn = new common_namespace_function_node("Dispose", null); cnfn.parameters.Clear(); cnfn.parameters.Add(new common_parameter("ptr", _pointer_type, SemanticTree.parameter_type.value, null)); sc.AddSymbol("dispose", new SymbolInfo(cnfn)); }
public void set_raise_function(common_namespace_function_node meth) { _raise_function = meth; }
private static void init_temp_methods_and_consts(common_namespace_node system_namespace, SymbolTable.Scope where_add, initialization_properties initialization_properties, location system_unit_location) { //SymbolTable.Scope sc = system_namespace.scope; SymbolTable.Scope sc = where_add; namespace_constant_definition _true_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SystemLibrary.true_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_true_constant_definition); namespace_constant_definition _false_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SystemLibrary.false_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_false_constant_definition); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_true_constant_definition)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_false_constant_definition)); //TODO: Сделано по быстрому. Переделать. Можно просто один раз сериализовать модуль system и не инициализировать его всякий раз подобным образом. Неплохо-бы использовать NetHelper.GetMethod. Type tp = typeof(Console); compiled_function_node cfn; System.Type[] arr = new System.Type[1]; System.Reflection.MethodInfo mi; //TODO: Сделать узел или базовый метод создания и удаления объекта. common_namespace_function_node cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.New; _NewProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _NewProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _NewProcedureDecl = cnfn; sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.dispose_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); _DisposeProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _DisposeProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _DisposeProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _DisposeProcedureDecl = cnfn; cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.Dispose; sc.AddSymbol(TreeConverter.compiler_string_consts.dispose_procedure_name, _DisposeProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_array_procedure_name, compiled_type_node.get_type_node(typeof(Array)), null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("t", compiled_type_node.get_type_node(typeof(Type)), SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.parameters.AddElement(new common_parameter("n", SystemLibrary.integer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.NewArray; _NewArrayProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewArrayProcedureDecl = cnfn; //sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); basic_function_node break_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name); break_procedure.compile_time_executor = initialization_properties.break_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(break_procedure)); basic_function_node continue_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name); continue_procedure.compile_time_executor = initialization_properties.continue_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(continue_procedure)); basic_function_node exit_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name); exit_procedure.compile_time_executor = initialization_properties.exit_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(exit_procedure)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.resize_func, PascalABCCompiler.TreeConverter.access_level.al_public, PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function)); }