コード例 #1
0
 public ExpectedAnotherKindOfObject(general_node_type[] expected_node_types, general_node_type met_node_type,
     ILocation def_location, ILocation use_location)
 {
     _expected_node_types = expected_node_types;
     _met_node_type = met_node_type;
     _def_location = def_location;
     _use_location = use_location;
 }
コード例 #2
0
 //проверки на константные параметры
 internal static bool check_for_constant_or_readonly(expression_node ex, out bool flag, out general_node_type gnd)
 {
     gnd = general_node_type.expression;
     flag = true;
 	switch (ex.semantic_node_type)
     {
         case semantic_node_type.array_const:
         case semantic_node_type.bool_const_node:
         case semantic_node_type.byte_const_node:
         case semantic_node_type.char_const_node:
         case semantic_node_type.class_constant_definition:
         case semantic_node_type.compiled_class_constant_definition:
         case semantic_node_type.namespace_constant_definition:
         case semantic_node_type.namespace_constant_reference:
     		flag = true;
             return true;
         case semantic_node_type.class_field_reference:
             class_field_reference cfr = ex as class_field_reference;
             if (cfr.field.IsReadOnly) 
             {
             	flag = false;
             	gnd = general_node_type.variable_node;
             	return true;
             }
             return check_for_constant_or_readonly(cfr.obj,out flag,out gnd);
         case semantic_node_type.static_compiled_variable_reference:
             static_compiled_variable_reference scvr = ex as static_compiled_variable_reference;
            	if (scvr.var.IsReadOnly) 
            	{
            		flag = false;
             	gnd = general_node_type.variable_node;
            		return true;
            	}
            	else if (scvr.var.IsLiteral)
            	{
            		flag = true;
            		gnd = general_node_type.variable_node;
            		return true;
            	}
            	return false;
         case semantic_node_type.compiled_variable_reference:
            	compiled_variable_reference cvr = ex as compiled_variable_reference;
            	if (cvr.var.IsReadOnly) 
            	{
            		flag = false;
             	gnd = general_node_type.variable_node;
            		return true;
            	}
            	else if (cvr.var.IsLiteral)
            	{
            		flag = true;
            		gnd = general_node_type.variable_node;
            		return true;
            	}
            	if (cvr.obj != null)
            	return check_for_constant_or_readonly(cvr.obj,out flag,out gnd);
            	return false;
         case semantic_node_type.common_parameter_reference:
             common_parameter_reference cpr = ex as common_parameter_reference;
             flag = true;
             return (cpr.par.concrete_parameter_type == concrete_parameter_type.cpt_const);
         case semantic_node_type.simple_array_indexing:
             simple_array_indexing sai = ex as simple_array_indexing;
             return check_for_constant_or_readonly(sai.simple_arr_expr,out flag,out gnd);
         default:
             return false;
     }
 }
コード例 #3
0
 	public  CanNotAssignToReadOnlyElement(location loc, general_node_type node_type):base(loc)
 	{
 		this._node_type = node_type;
 	}