当前位置: 首页>>代码示例>>C#>>正文


C# TreeConverter.SymbolInfo类代码示例

本文整理汇总了C#中PascalABCCompiler.TreeConverter.SymbolInfo的典型用法代码示例。如果您正苦于以下问题:C# SymbolInfo类的具体用法?C# SymbolInfo怎么用?C# SymbolInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SymbolInfo类属于PascalABCCompiler.TreeConverter命名空间,在下文中一共展示了SymbolInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreSymbols

 static void RestoreSymbols(SymbolInfo si, PascalABCCompiler.TreeRealization.wrapped_definition_node wdn, string name)
 {
 	if (wdn.is_synonim)
 		si.sym_info = wdn.PCUReader.CreateTypeSynonim(wdn.offset, name);
 	else
 	if (si.scope is ClassScope)
         si.sym_info = wdn.PCUReader.CreateInterfaceInClassMember(wdn.offset, name);
     else
         si.sym_info = wdn.PCUReader.CreateImplementationMember(wdn.offset, false);
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:10,代码来源:SymbolTable.cs

示例2: RestoreSymbolsInterfaceMember

 public static void RestoreSymbolsInterfaceMember(SymbolInfo si, string name)
 {
     while (si != null)
     {
         if (si.sym_info!=null)
         if (si.sym_info.semantic_node_type == PascalABCCompiler.TreeRealization.semantic_node_type.wrap_def)
         {
             PascalABCCompiler.TreeRealization.wrapped_definition_node wdn = (PascalABCCompiler.TreeRealization.wrapped_definition_node)si.sym_info;
             si.sym_info = wdn.PCUReader.CreateInterfaceMember(wdn.offset, name);
         }
         si = si.Next;
     }
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:13,代码来源:SymbolTable.cs

示例3: address_expression_reciving

 private addressed_expression address_expression_reciving(SyntaxTree.ident id_right, SymbolInfo si,
     expression_node en)
 {
     if (si != null && si.sym_info != null &&
         si.sym_info.semantic_node_type == semantic_node_type.indefinite_definition_node)
     {
         return new indefinite_reference(si.sym_info as indefinite_definition_node, get_location(id_right));
     }
 	definition_node dn = null;
 	if (!internal_is_assign)
         dn = context.check_name_node_type(id_right.name, si, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node);
     else
         dn = context.check_name_node_type(id_right.name, si, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node, general_node_type.constant_definition);
     if (dn.general_node_type == general_node_type.constant_definition)
     {
         AddError(get_location(id_right), "CAN_NOT_ASSIGN_TO_CONSTANT_OBJECT");
     }
     switch (dn.general_node_type)
     {
         case general_node_type.variable_node:
             {
                 return create_class_field_reference(en, dn, id_right);
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 if (pn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToStaticPropertyWithExpression(pn, get_location(id_right), pn.comprehensive_type));
                 }
                 try_convert_typed_expression_to_function_call(ref en);
                 non_static_property_reference pr = new non_static_property_reference(pn, en, get_location(id_right));
                 return pr;
             }
         case general_node_type.event_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.compiled_event)
                 {
                     compiled_event ce = (compiled_event)dn;
                     if (ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
                     return ser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_event)
                 {
                     common_event ce = (common_event)dn;
                     if (ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
                     return ser;
                 }
                 break;
             }
     	default : return null;
     }
     throw new CompilerInternalError("Undefined expression to address reciving");
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:64,代码来源:syntax_tree_visitor.cs

示例4: convert_typed_expression_to_function_call

        internal expression_node convert_typed_expression_to_function_call(typed_expression te)
        {
            delegated_methods dm = te.type as delegated_methods;
            if (dm == null)
            {
                return te;
            }
            base_function_call bfc = dm.empty_param_method;
            if (bfc == null)
            {
                return te;
            }
            if (bfc.type == null) 
            	return te;
            function_node fn = bfc.simple_function_node;
            common_namespace_function_node cnfn = fn as common_namespace_function_node;
            if ((fn.parameters.Count == 1 || cnfn != null && fn.parameters.Count == 2 && cnfn.ConnectedToType != null)
                && (fn.parameters[fn.parameters.Count - 1].is_params || fn.parameters[fn.parameters.Count - 1].default_value != null))
            {
                fn = convertion_data_and_alghoritms.select_function(bfc.parameters, new SymbolInfo(fn), bfc.location);
                if (fn.polymorphic_state == SemanticTree.polymorphic_state.ps_static || fn is common_namespace_function_node || fn is basic_function_node)
                    bfc = convertion_data_and_alghoritms.create_simple_function_call(fn, bfc.location, bfc.parameters.ToArray()) as base_function_call;
                else
                {
                    expression_node obj = null;
                    if (bfc is common_method_call)
                        obj = (bfc as common_method_call).obj;
                    else if (bfc is compiled_function_call)
                        obj = (bfc as compiled_function_call).obj;
                    bfc = convertion_data_and_alghoritms.create_method_call(fn, bfc.location, obj, bfc.parameters.ToArray()) as base_function_call;

                }   
            }
            else
            {
                function_node[] empty_param_methods = dm.empty_param_methods;
                SymbolInfo si = new SymbolInfo(empty_param_methods[0]);
                SymbolInfo root_si = si;
                for (int i = 1; i < empty_param_methods.Length; i++)
                {
                    si.Next = new SymbolInfo(empty_param_methods[i]);
                    si = si.Next;
                }
                compiled_function_node cfn = fn as compiled_function_node;
                if ((fn.parameters.Count == 1 || cfn != null && fn.parameters.Count == 2 && cfn.ConnectedToType != null)
                    && (fn.parameters[fn.parameters.Count - 1].is_params || fn.parameters[fn.parameters.Count - 1].default_value != null))
                {
                    fn = convertion_data_and_alghoritms.select_function(bfc.parameters, root_si, bfc.location);
                    bfc = create_static_method_call_with_params(fn, bfc.location, fn.return_value_type, true, bfc.parameters);
                }
                else if (fn.parameters.Count == 1 && cfn != null && cfn.ConnectedToType != null)
                {
                    fn = convertion_data_and_alghoritms.select_function(bfc.parameters, root_si, bfc.location);
                    bfc = create_static_method_call_with_params(fn, bfc.location, fn.return_value_type, true, bfc.parameters);
                }
            }
            return bfc;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:58,代码来源:syntax_tree_visitor.cs

示例5: create_addressed_with_type_expression

 private addressed_expression create_addressed_with_type_expression(type_node tn, SyntaxTree.ident id_right,
     SymbolInfo si_right)
 {
     definition_node dn = null;
     if (!internal_is_assign)
     dn = context.check_name_node_type(id_right.name, si_right, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node);
     else
         dn = context.check_name_node_type(id_right.name, si_right, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node,general_node_type.constant_definition);
     if (dn.general_node_type == general_node_type.constant_definition)
         AddError(get_location(id_right), "CAN_NOT_ASSIGN_TO_CONSTANT_OBJECT");
     switch (dn.general_node_type)
     {
         case general_node_type.variable_node:
             {
                 return create_class_static_field_reference(tn, dn, id_right);
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 if (pn.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToNonStaticPropertyWithType(pn, get_location(id_right), tn));
                 }
                 static_property_reference pr = new static_property_reference(pn, get_location(id_right));
                 return pr;
             }
         case general_node_type.event_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.compiled_event)
                 {
                     compiled_event ce = (compiled_event)dn;
                     if (!ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     static_event_reference ser = new static_event_reference(ce, get_location(id_right));
                     return ser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_event)
                 {
                     common_event ce = (common_event)dn;
                     if (!ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     static_event_reference ser = new static_event_reference(ce, get_location(id_right));
                     return ser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_namespace_event)
                 {
                     common_namespace_event cne = dn as common_namespace_event;
                     static_event_reference ser = new static_event_reference(cne, get_location(id_right));
                     return ser;
                 }
                 break;
             }
     		default : return null;
     }
     throw new CompilerInternalError("Invalid right type expression");
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:62,代码来源:syntax_tree_visitor.cs

示例6: make_dec_call

        private expression_node make_dec_call(SymbolInfo si, SyntaxTree.expression_list parameters, location loc)
        {
        	if (parameters == null) throw new NoFunctionWithSameParametresNum(loc,false,si.sym_info as function_node);
        	if (parameters.expressions.Count == 1 || parameters.expressions.Count == 2)
        	{
        		expression_node param0 = convert_strong(parameters.expressions[0]);
        		if (!param0.is_addressed)
        		{
        			bool is_pascal_array_ref = false;
                    if (param0.semantic_node_type == semantic_node_type.common_method_call)
                    {
                        common_method_call cmc = (common_method_call)param0;
                        internal_interface ii = cmc.obj.type.get_internal_interface(internal_interface_kind.bounded_array_interface);
                        if (ii != null)
                        {
                            if (cmc.function_node.name == compiler_string_consts.get_val_pascal_array_name)
                            {
                                bounded_array_interface bai = (bounded_array_interface)ii;
                                class_field cf = bai.int_array;
                                expression_node left = new class_field_reference(cf, cmc.obj, cmc.location);
                                expression_node right = cmc.parameters[0];
                                //right = convert_type(right, SystemLibrary.SystemLibrary.integer_type);
                                right = convertion_data_and_alghoritms.convert_type(right, (ii as bounded_array_interface).ordinal_type_interface.elems_type);
                                right = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibrary.int_sub, cmc.location, right,
                                    new int_const_node(bai.ordinal_type_interface.ordinal_type_to_int(bai.ordinal_type_interface.lower_value), cmc.location));
                                param0 = new simple_array_indexing(left, right, cmc.type, cmc.location);
                                is_pascal_array_ref = true;

                            }
                        }
                        if (!is_pascal_array_ref)
                        {
							throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
                    	}
        				
        			}
                    else if (param0 is compiled_function_call)
                    {
                    	compiled_function_call cfc = param0 as compiled_function_call;
                    	if ((cfc.function_node.return_value_type == SystemLibrary.SystemLibrary.char_type && cfc.function_node.cont_type == SystemLibrary.SystemLibrary.string_type
                    	      && cfc.function_node == cfc.function_node.cont_type.default_property_node.get_function))
                    	{
                    		expressions_list exl = new expressions_list();
                            exl.AddElement(cfc.obj);
                            exl.AddElement(cfc.parameters[0]);
                            basic_function_call bfc2 = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
                            bfc2.parameters.AddElement(param0);
                            expression_node _param1 = null;
                            if (parameters.expressions.Count == 2) 
        					{
        						_param1 = convert_strong(parameters.expressions[1]);
        					}
                            if (_param1 != null)
                            	bfc2.parameters.AddElement(convertion_data_and_alghoritms.convert_type(_param1,SystemLibrary.SystemLibrary.integer_type));
                            else
                            	bfc2.parameters.AddElement(new int_const_node(1,null));
                            expressions_list el = new expressions_list();
                            el.AddElement(convertion_data_and_alghoritms.convert_type(bfc2,SystemLibrary.SystemLibrary.ushort_type));
                            function_node chr_func = convertion_data_and_alghoritms.select_function(el, SystemLibrary.SystemLibInitializer.ChrUnicodeFunction.SymbolInfo, loc);
                            exl.AddElement(convertion_data_and_alghoritms.create_simple_function_call(chr_func, loc, el.ToArray()));
                            function_node fn = convertion_data_and_alghoritms.select_function(exl, SystemLibrary.SystemLibInitializer.StringDefaultPropertySetProcedure.SymbolInfo, loc);
                            expression_node ret = convertion_data_and_alghoritms.create_simple_function_call(fn, loc, exl.ToArray());
                            return ret;
                    	}
                    	else
                    	{
                    		throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
                    	}
                    }
                    else throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
        		}
        		else
        			check_on_loop_variable(param0);
        		expression_node param1 = null;
        		int type_flag = 0;
        		bool is_uint=false;
        		bool is_enum=false;
        		if (parameters.expressions.Count == 2) 
        		{
        			param1 = convert_strong(parameters.expressions[1]);
        			param1 = convertion_data_and_alghoritms.convert_type(param1,SystemLibrary.SystemLibrary.integer_type);
        		}
        		basic_function_call ass = null;
        		basic_function_call bfc = null;
        		if (param0.type == SystemLibrary.SystemLibrary.integer_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.int_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.char_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.char_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.byte_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.byte_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.sbyte_type)
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例7: make_dispose_call

        private expression_node make_dispose_call(SymbolInfo si, SyntaxTree.expression_list parameters, location loc)
        {
            if (parameters == null)
            {
                AddError(new NoFunctionWithSameParametresNum(loc, false, si.sym_info as function_node));
                return null;
            }
            if (parameters.expressions.Count == 1)
            {
                expression_node param0 = convert_strong(parameters.expressions[0]);
                if (!param0.type.IsPointer || param0.type == SystemLibrary.SystemLibrary.pointer_type)
                    AddError(new NoFunctionWithSameArguments(loc, true));
                if (!param0.is_addressed)
                {
                    bool is_pascal_array_ref = false;
                    if (param0.semantic_node_type == semantic_node_type.common_method_call)
                    {
                        common_method_call cmc = (common_method_call)param0;
                        internal_interface ii = cmc.obj.type.get_internal_interface(internal_interface_kind.bounded_array_interface);
                        if (ii != null)
                        {
                            if (cmc.function_node.name == compiler_string_consts.get_val_pascal_array_name)
                            {
                                bounded_array_interface bai = (bounded_array_interface)ii;
                                class_field cf = bai.int_array;
                                expression_node left = new class_field_reference(cf, cmc.obj, cmc.location);
                                expression_node right = cmc.parameters[0];
                                //right = convert_type(right, SystemLibrary.SystemLibrary.integer_type);
                                right = convertion_data_and_alghoritms.convert_type(right, (ii as bounded_array_interface).ordinal_type_interface.elems_type);
                                right = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibrary.int_sub, cmc.location, right,
                                    new int_const_node(bai.ordinal_type_interface.ordinal_type_to_int(bai.ordinal_type_interface.lower_value), cmc.location));
                                param0 = new simple_array_indexing(left, right, cmc.type, cmc.location);
                                is_pascal_array_ref = true;
                            }
                        }
                        if (!is_pascal_array_ref)
                        {
                            AddError(new ThisExpressionCanNotBePassedAsVarParameter(param0));
                            return null;
                        }

                    }
                    else
                    {
                        AddError(new ThisExpressionCanNotBePassedAsVarParameter(param0));
                        return null;
                    }
                }
                function_node fn = si.sym_info as function_node;
                common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, loc);
                cnfc.parameters.AddElement(param0);
                return cnfc;

            }
            else
            {
                AddError(new NoFunctionWithSameParametresNum(loc, false, si.sym_info as function_node));
                return null;
            }
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:60,代码来源:syntax_tree_visitor.cs

示例8: delete_inherited_constructors

 //ssyy
 //Удаляет конструкторы предков в списке si
 private void delete_inherited_constructors(ref SymbolInfo si, type_node tn)
 {
     SymbolInfo last_sym = null;
     SymbolInfo cur_sym = si;
     while (cur_sym != null)
     {
         type_node comph_type = null;
         bool is_ctor = false;
         common_method_node mnode = cur_sym.sym_info as common_method_node;
         if (mnode != null)
         {
             comph_type = mnode.cont_type;
             is_ctor = mnode.is_constructor;
         }
         else
         {
             compiled_function_node tnode = cur_sym.sym_info as compiled_function_node;
             if (tnode != null)
             {
                 comph_type = tnode.cont_type;
                 is_ctor = tnode.method_info.IsConstructor;
             }
         }
         //Итак, comph_type - класс, содержащий si.sym_info;
         //is_ctor - является ли оно конструктором
         if (is_ctor && comph_type != tn)
         {
             //Удаляем
             if (last_sym == null)
             {
                 si = si.Next;
             }
             else
             {
                 last_sym.Next = cur_sym.Next;
             }
         }
         else
         {
             last_sym = cur_sym;
         }
         cur_sym = cur_sym.Next;
     }
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:46,代码来源:syntax_tree_visitor.cs

示例9: ident_value_reciving

 private expression_node ident_value_reciving(SymbolInfo si, SyntaxTree.ident _ident)
 {
     //SymbolInfo si=blocks.find(_ident.name);
     location lloc = get_location(_ident);
     definition_node dn = context.check_name_node_type(_ident.name, si, get_location(_ident), general_node_type.variable_node,
         general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition,
         general_node_type.event_node);
     switch (dn.general_node_type)
     {
         case general_node_type.constant_definition:
             {
                 constant_definition_node cdn = (constant_definition_node)dn;
                 if (cdn.const_value is array_const || cdn.const_value is record_constant || cdn.const_value is common_namespace_function_call_as_constant)
                 {
                 	return create_constant_reference(cdn,lloc);
                 }
                 if (cdn.const_value == null)
                     AddError(new UndefinedNameReference(cdn.name,get_location(_ident)));
                 constant_node cn = cdn.const_value.get_constant_copy(get_location(_ident));
                 if (cn != null) return cn;
                 return cdn.const_value;
             }
         case general_node_type.variable_node:
             {
                 local_variable lv = dn as local_variable;
                 if (lv != null && (lv.function is common_method_node))
                 {
                     //self variable
                     if ((lv.function as common_method_node).self_variable == lv)
                         //return new this_node((lv.function as common_method_node).cont_type, lloc);
                         return new this_node(lv.type, lloc);
                     //return GetCurrentObjectReference((lv.function as common_method_node).cont_type.Scope, lloc);
                 }
                 return create_variable_reference(dn, lloc);
             }
         case general_node_type.function_node:
             {
                 //return convertion_data_and_alghoritms.create_full_function_call(new expressions_list(),
                 //	si,lloc,blocks.converted_type,blocks.top_function,false);
                 if (!(si.sym_info is common_in_function_function_node))
                     return make_delegate_wrapper(null, si, lloc, ((si.sym_info is common_method_node) && ((common_method_node)si.sym_info).IsStatic));
                 return convertion_data_and_alghoritms.create_full_function_call(new expressions_list(),
                 	si,lloc,context.converted_type,context.top_function,false);
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 function_node fn = pn.get_function;
                 if (fn == null)
                 {
                     AddError(new ThisPropertyCanNotBeReaded(pn, lloc));
                 }
                 if (pn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     return create_static_method_call(fn, lloc, pn.comprehensive_type, false);
                 }
                 check_property_no_params(pn, lloc);
                 //this_node thisnode = new this_node(context.converted_type, lloc);
                 if (pn.comprehensive_type.Scope == null && pn is compiled_property_node)
                 	(pn.comprehensive_type as compiled_type_node).init_scope();
                 return create_not_static_method_call(fn, GetCurrentObjectReference(pn.comprehensive_type.Scope, fn, lloc), lloc, false);
             }
         case general_node_type.event_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.compiled_event)
                 {
                     compiled_event ce = (compiled_event)dn;
                     if (ce.is_static)
                     {
                         static_event_reference ser = new static_event_reference(ce, get_location(_ident));
                         return ser;
                     }
                     nonstatic_event_reference nser = new nonstatic_event_reference(
                         new this_node(context.converted_type, lloc), ce, lloc);
                     return nser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_event)
                 {
                     common_event ce = (common_event)dn;
                     if (ce.is_static)
                     {
                         static_event_reference ser = new static_event_reference(ce, get_location(_ident));
                         return ser;
                     }
                     nonstatic_event_reference nser = new nonstatic_event_reference(
                         new this_node(context.converted_type, lloc), ce, lloc);
                     return nser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_namespace_event)
                 {
                     common_namespace_event cne = (common_namespace_event)dn;
                     if (_compiled_unit.namespaces.IndexOf(cne.namespace_node) != -1)
                     {
                         static_event_reference ser = new static_event_reference(cne, get_location(_ident));
                         return ser;
                     }
                     else
                         AddError(get_location(_ident), "EVENT_{0}_MUST_BE_IN_LEFT_PART", cne.name);
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例10: ident_address_reciving

 private addressed_expression ident_address_reciving(SymbolInfo si, SyntaxTree.ident _ident)
 {
     location lloc = get_location(_ident);
     definition_node dn = null;
     if (!internal_is_assign)
         dn = context.check_name_node_type(_ident.name, si, lloc,
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node);
     else
         dn = context.check_name_node_type(_ident.name, si, lloc,
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node, general_node_type.constant_definition);
     if (dn.general_node_type == general_node_type.constant_definition)
         AddError(get_location(_ident), "CAN_NOT_ASSIGN_TO_CONSTANT_OBJECT");
     switch (dn.general_node_type)
     {
         case general_node_type.variable_node:
             {
                 local_variable lv = dn as local_variable;
                 if (lv != null && (lv.function is common_method_node))
                 {
                     //self variable
                     if ((lv.function as common_method_node).self_variable == lv)
                         AddError(lloc, "VARIABLE_{0}_READONLY", lv.name);
                 }
                 return create_variable_reference(dn, lloc);
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 if (pn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     static_property_reference spr = new static_property_reference(pn, lloc);
                     return spr;
                 }
                 //this_node thisnode=new this_node(context.converted_type,lloc);
                 if (pn.comprehensive_type.Scope == null && pn is compiled_property_node)
                 	(pn.comprehensive_type as compiled_type_node).init_scope();
                 non_static_property_reference nspr = new non_static_property_reference(pn, GetCurrentObjectReference(pn.comprehensive_type.Scope, pn, lloc), lloc);
                 return nspr;
             }
         case general_node_type.event_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.compiled_event)
                 {
                     compiled_event ce = (compiled_event)dn;
                     if (ce.is_static)
                     {
                         static_event_reference ser = new static_event_reference(ce, get_location(_ident));
                         return ser;
                     }
                     nonstatic_event_reference nser = new nonstatic_event_reference(
                         GetCurrentObjectReference(ce.comprehensive_type.Scope, ce, lloc), ce, lloc);
                     return nser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_event)
                 {
                 	common_event ce = (common_event)dn;
                 	if (ce.is_static)
                     {
                         static_event_reference ser = new static_event_reference(ce, get_location(_ident));
                         return ser;
                     }
                     nonstatic_event_reference nser = new nonstatic_event_reference(
                         GetCurrentObjectReference(ce.comprehensive_type.Scope, ce, lloc), ce, lloc);
                     return nser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_namespace_event)
                 {
                     common_namespace_event cne = (common_namespace_event)dn;
                     static_event_reference ser = new static_event_reference(cne, get_location(_ident));
                     return ser;
                 }
                 break;
             }
     }
     return null;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:76,代码来源:syntax_tree_visitor.cs

示例11: create_possible_delegates_list

        private base_function_call_list create_possible_delegates_list(expression_node obj, SymbolInfo si, location loc, bool is_static)
        {
            if (si == null)
            {
                return new base_function_call_list();
            }
            function_node_list fnl = new function_node_list();
            while (si != null)
            {
                function_node fn = si.sym_info as function_node;
                if (si.sym_info is compiled_property_node)
                {
                    fn = (si.sym_info as compiled_property_node).get_function; 
                }
                else if (si.sym_info is common_property_node)
                {
                    fn = (si.sym_info as common_property_node).get_function;
                }
                if (convertion_data_and_alghoritms.find_eq_method_in_list(fn, fnl) == null)
                {
                    if (!(obj != null && fn.polymorphic_state == SemanticTree.polymorphic_state.ps_static && !fn.is_extension_method))
                    {
                        if (fn.is_extension_method)
                        {
                            if (obj != null && (fn.parameters[0].type == obj.type || type_table.compare_types(fn.parameters[0].type, obj.type) == type_compare.greater_type))
                                fnl.AddElementFirst(fn);
                            else
                                fnl.AddElement(fn);
                        }
                        else
                            fnl.AddElement(fn);
                    }
                }
                else
                {

                }
                si = si.Next;
            }
            return convert_functions_to_calls(obj, fnl, loc, is_static);
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:41,代码来源:syntax_tree_visitor.cs

示例12: FunctionExsistsInSymbolInfo

 private bool FunctionExsistsInSymbolInfo(function_node fn, SymbolInfo si)
 {
     while (si != null)
     {
         if (si.sym_info is function_node)
             if (convertion_data_and_alghoritms.function_eq_params(fn, si.sym_info as function_node))
                 return true;
         si = si.Next;
     }
     return false;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:11,代码来源:syntax_tree_visitor.cs

示例13: create_function

		public common_function_node create_function(string name,location def_loc)
		{
			check_function_name(name,def_loc);
			common_function_node cfn=null;
			switch (converting_block())
			{
				case block_type.function_block:
				{
                    common_function_node top_func = _func_stack.top();
                    SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateScope(top_func.scope);
					common_in_function_function_node ciffn;
					ciffn=new common_in_function_function_node(name,def_loc,top_func,scope);
					top_func.functions_nodes_list.AddElement(ciffn);
					_last_created_function=new SymbolInfo(ciffn);
					top_func.scope.AddSymbol(name,_last_created_function);
					cfn=ciffn;
					break;
				}
				case block_type.type_block:
				{
					common_method_node cmmn;
                    SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope, _ctn.Scope);
                    //TODO:сделать static и virtual.
                    //TODO: interface and implementation scopes.
					cmmn=new common_method_node(name,def_loc,_ctn,SemanticTree.polymorphic_state.ps_common,_fal,scope);
					_last_created_function=new SymbolInfo(cmmn);
					_ctn.Scope.AddSymbol(name,_last_created_function);
					_ctn.methods.AddElement(cmmn);

                    local_variable lv = new local_variable(compiler_string_consts.self_word, _ctn, cmmn, def_loc);
                    cmmn.scope.AddSymbol(compiler_string_consts.self_word, new SymbolInfo(lv));
                    cmmn.self_variable = lv;
                    cmmn.var_definition_nodes_list.AddElement(lv);

					cfn=cmmn;
					break;
				}
				case block_type.namespace_block:
				{
					common_namespace_function_node cnfnn;
                    SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateScope(_cmn.scope);
					cnfnn=new common_namespace_function_node(name,def_loc,_cmn,scope);
					_cmn.functions.AddElement(cnfnn);
					_last_created_function=new SymbolInfo(cnfnn);
					_cmn.scope.AddSymbol(name,_last_created_function);
					cfn=cnfnn;
					break;
				}
			}
			_func_stack.push(cfn);
			return cfn;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:52,代码来源:block_info.cs

示例14: visit_method_call

        internal void visit_method_call(SyntaxTree.method_call _method_call)
        {
            // frninja 01/03/16 - for iterator capturing (yield)
            if (_method_call.dereferencing_value is yield_unknown_ident)
            {
                var nodeToVisit = new method_call(ProcessUnknownIdent(_method_call.dereferencing_value as yield_unknown_ident), _method_call.parameters);
                visit(nodeToVisit);
                return;
            }
            // end frninja

            //lroman
            if (_method_call.dereferencing_value is closure_substituting_node)
            {
                var nodeToVisit =
                    new method_call(((closure_substituting_node) _method_call.dereferencing_value).substitution,
                                    _method_call.parameters);
                visit(nodeToVisit);
                return;
            }

            bool proc_wait = procedure_wait;
			bool lambdas_are_in_parameters = false; //lroman//

            var syntax_nodes_parameters = _method_call.parameters == null
                                              ? new List<expression>()
                                              : _method_call.parameters.expressions;
            if (procedure_wait)
            {
                procedure_wait = false;
            }
            //throw new ArgumentNullException("test");

            motivation mot = motivation_keeper.motivation;

            expression_node expr_node = null;
            expressions_list exprs = new expressions_list();

            SyntaxTree.ident id = null;

            SymbolInfo si = null;

            type_node to_type = null;

            SyntaxTree.addressed_value deref_value = _method_call.dereferencing_value;
            int templ_args_count = 0;
            //bool needs_generic_type_search = false;
            SyntaxTree.ident_with_templateparams iwt = deref_value as SyntaxTree.ident_with_templateparams;
            if (iwt != null)
            {
                deref_value = iwt.name;
                templ_args_count = iwt.template_params.params_list.Count;
                //needs_generic_type_search = _method_call.parameters.expressions.Count == 1;
            }

            SyntaxTree.inherited_ident inh_id = deref_value as SyntaxTree.inherited_ident;
            if (inh_id != null)
            {
                inherited_ident_processing = true;
                si = find_in_base(inh_id);
                if (si != null) 
            	if (si.sym_info is common_method_node)
            	{
            		if ((si.sym_info as common_method_node).polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract)
                        AddError(get_location(inh_id), "CANNOT_CALL_ABSTRACT_METHOD");
            	}
            	else
            	if (si.sym_info is compiled_function_node)
            	{
            		if ((si.sym_info as compiled_function_node).polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract)
                        AddError(get_location(inh_id), "CANNOT_CALL_ABSTRACT_METHOD");
            	}
                id = inh_id;
            }
            else
            {
                id = deref_value as SyntaxTree.ident;
                if (id != null)
                {
                    if (templ_args_count != 0)
                    {
                        //Ищем generics
                        si = context.find(id.name + compiler_string_consts.generic_params_infix + templ_args_count.ToString());
                        if (si != null)
                        {
                            si = new SymbolInfo(get_generic_instance(si, iwt.template_params.params_list));
                            iwt = null;
                        }
                    }
                    if (si == null)
                    {
                        SyntaxTree.operator_name_ident oni = id as SyntaxTree.operator_name_ident;
                        if (oni != null)
                        {
                            si = context.find(name_reflector.get_name(oni.operator_type));
                        }
                        else
                        {
                            si = context.find(id.name);
                            if (templ_args_count != 0)
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例15: delete_extension_methods

 //remove extension methods when static methods called
 private void delete_extension_methods(ref SymbolInfo si, type_node tn)
 {
     List<SymbolInfo> si_list = new List<SymbolInfo>();
     SymbolInfo tmp_si = si;
     while (tmp_si != null)
     {
         var fn = tmp_si.sym_info as function_node;
         if (fn != null)
         {
             if (fn.is_extension_method)
             {
                 compiled_function_node cfn = fn as compiled_function_node;
                 if (cfn != null && cfn.cont_type == tn)
                     si_list.Add(tmp_si);
             }
             else
                 si_list.Add(tmp_si);
         }
         else
             si_list.Add(tmp_si);
         /*if (!(fn != null && fn.is_extension_method))
             si_list.Add(tmp_si);*/
         tmp_si = tmp_si.Next;
     }
     /*tmp_si = si;
     while (tmp_si != null)
     {
         var fn = tmp_si.sym_info as function_node;
         if (fn != null && fn.is_extension_method)
         {
             var b = false;
             foreach (var x in si_list)
             {
                 var xn = x.sym_info as function_node;
                 if (convertion_data_and_alghoritms.function_eq_params(fn, xn))
                 {
                     b = true;
                     break;
                 }
             }
             if (!b)
                 si_list.Add(tmp_si);
         }
         tmp_si = tmp_si.Next;
     }*/
     SymbolInfo new_si = null;
     for (int i = 0; i < si_list.Count; i++)
     {
         if (new_si == null)
         {
             new_si = si_list[i];
             si = new_si;
         }
         else
         {
             si.Next = si_list[i];
             si = si.Next;
         }
     }
     if (si != null)
         si.Next = null;
     si = new_si;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:64,代码来源:syntax_tree_visitor.cs


注:本文中的PascalABCCompiler.TreeConverter.SymbolInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。