本文整理汇总了C#中PascalABCCompiler.TreeRealization.location类的典型用法代码示例。如果您正苦于以下问题:C# location类的具体用法?C# location怎么用?C# location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
location类属于PascalABCCompiler.TreeRealization命名空间,在下文中一共展示了location类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: common_event
public common_event(string name, type_node del_type, common_type_node cont_type, common_method_node add_method, common_method_node remove_method, common_method_node raise_method,
SemanticTree.field_access_level fal, SemanticTree.polymorphic_state ps, location loc)
{
this._name = name;
this.del_type = del_type;
this._add_method = add_method;
this._remove_method = remove_method;
this._raise_method = raise_method;
this._field_access_level = fal;
this._polymorphic_state = ps;
this._cont_type = cont_type;
this._loc = loc;
}
示例2: convert_string_const_to_switch
private string_const_node convert_string_const_to_switch(expression_node switch_expr, location loc)
{
if (switch_expr is string_const_node)
return switch_expr as string_const_node;
string_const_node scn = null;
if (switch_expr is static_compiled_variable_reference && (switch_expr as static_compiled_variable_reference).var.compiled_field.IsLiteral)
scn = new string_const_node((string)(switch_expr as static_compiled_variable_reference).var.compiled_field.GetRawConstantValue(), loc);
if (scn == null)
{
AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
}
return scn;
}
示例3: AddWarning
private void AddWarning(string message, location loc)
{
warns.Add(new GenericWarning(message, loc));
}
示例4: delegated_empty_method
internal static expression_node delegated_empty_method(location call_loc,expression_node[] expr)
{
if (expr.Length != 1)
{
return null;
}
return expr[0];
}
示例5: get_empty_method_call
public static expression_node get_empty_method_call(location loc)
{
return new basic_function_call(_empty_method, loc);
}
示例6: compare_ordinal_type
private static bool compare_ordinal_type(constant_node left,constant_node right,compile_time_executor cte,
location call_location)
{
expression_node ret_expr=cte(call_location,left,right);
if (ret_expr == null)
{
throw new CompilerInternalError("Expected compile-time executed expression.");
}
bool_const_node bcn = ret_expr as bool_const_node;
if (bcn == null)
{
throw new CompilerInternalError("Expected bool value.");
}
return bcn.constant_value;
}
示例7: common_function_node
/// <summary>
/// Конструктор узла.
/// </summary>
/// <param name="name">Имя функции.</param>
/// <param name="ret_type">Тип возвращаемого значения функции.</param>
/// <param name="loc">Расположение функции.</param>
/// <param name="scope">Пространство имен этой функции.</param>
public common_function_node(string name,type_node ret_type,location loc, SymbolTable.Scope scope) :
base(ret_type)
{
_name=name;
_loc = loc;
_scope = scope;
}
示例8: return_node
public return_node(expression_node return_expr,location loc) : base(loc)
{
_return_expr=return_expr;
}
示例9: convert_function_type
private common_type_node convert_function_type(SyntaxTree.procedure_header proc_header, location loc, string type_name, common_type_node del_type)
{
return convert_function_type(proc_header.parameters, null, loc, type_name, del_type);
}
示例10: CheckConstantRecordNotBeContainsMethods
private void CheckConstantRecordNotBeContainsMethods(common_type_node ctn, location loc)
{
if (ctn.is_value)
{
if (ctn.methods.Count > 0)
{
for (int i=0; i<ctn.methods.Count; i++)
if (ctn.methods[i].loc != null)
AddError(loc, "CONSTANT_RECORD_CAN_NOT_CONTAINS_METHODS");
}
//if (!(ctn.methods.Count == 2 && ctn.methods[0] is common_method_node && (ctn.methods[0] as common_method_node).is_constructor && ctn.methods[0].loc == null
// && ctn.methods[1] is common_method_node && ctn.methods[1].loc == null))
// throw new ConstantRecordCanNotContainsMethods(loc);
if (ctn.base_type is common_type_node)
CheckConstantRecordNotBeContainsMethods(ctn.base_type as common_type_node, loc);
}
else
{
if (IsBoundedArray(ctn) && ctn.element_type is common_type_node)
CheckConstantRecordNotBeContainsMethods(ctn.element_type as common_type_node, loc);
}
}
示例11: find_operator
private expression_node find_operator(SyntaxTree.Operators ot, expression_node expr, location loc)
{
string name = name_reflector.get_name(ot);
//#if (DEBUG)
if (name == null)
{
if (ot == PascalABCCompiler.SyntaxTree.Operators.AddressOf)
{
if (expr.is_addressed == false)
{
AddError(expr.location, "CAN_NOT_GET_ADDRESS_FROM_EXPRESSION");
}
expression_node res = new get_addr_node(expr, loc);
return res;
}
if (ot == PascalABCCompiler.SyntaxTree.Operators.Dereference)
{
}
throw new CompilerInternalError("Invalid operator name");
}
//#endif
SymbolInfo si = expr.type.find(name, context.CurrentScope);
if (si == null || si.sym_info is wrapped_definition_node)
{
AddError(new OperatorCanNotBeAppliedToThisType(name, expr));
}
expressions_list pars = new expressions_list();
pars.AddElement(expr);
function_node fn = convertion_data_and_alghoritms.select_function(pars, si, loc);
expr = pars[0];
if (fn == null)
{
AddError(new OperatorCanNotBeAppliedToThisType(name, expr));
}
#if (DEBUG)
convertion_data_and_alghoritms.check_operator(fn);
#endif
expression_node exp_node = convertion_data_and_alghoritms.create_simple_function_call(fn, loc, expr);
return exp_node;
}
示例12: find_function
//TODO: Обратить внимание на эту функцию. Ее вызовы не приводят к созданиям узлов преобразования типов.
private function_node find_function(string name, location loc, params expression_node[] exprs)
{
expressions_list exprs_list = new expressions_list();
exprs_list.AddRange(exprs);
return find_function(name, loc, exprs_list);
}
示例13: convert_const_to_switch
private int_const_node convert_const_to_switch(expression_node switch_expr,
ordinal_type_interface oti, type_node case_expr_type, location loc)
{
convertion_data_and_alghoritms.convert_type(switch_expr, case_expr_type, loc);
if (switch_expr is int_const_node)
return switch_expr as int_const_node;
//switch_expr = convertion_data_and_alghoritms.create_simple_function_call(oti.value_to_int,
// loc, switch_expr);
int_const_node icn = null;//switch_expr as constant_node;
if (switch_expr is byte_const_node)
icn = new int_const_node((switch_expr as byte_const_node).constant_value, loc);
else if (switch_expr is sbyte_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as sbyte_const_node).constant_value), loc);
else if (switch_expr is short_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as short_const_node).constant_value), loc);
else if (switch_expr is ushort_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as ushort_const_node).constant_value), loc);
/*else if (switch_expr is uint_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as uint_const_node).constant_value),loc);
else if (switch_expr is long_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as long_const_node).constant_value),loc);
else if (switch_expr is ulong_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as ulong_const_node).constant_value),loc);*/
else if (switch_expr is bool_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as bool_const_node).constant_value), loc);
else if (switch_expr is char_const_node)
icn = new int_const_node(Convert.ToInt32((switch_expr as char_const_node).constant_value), loc);
else if (switch_expr is enum_const_node)
icn = new int_const_node((switch_expr as enum_const_node).constant_value, loc);
else if (switch_expr is static_compiled_variable_reference && (switch_expr as static_compiled_variable_reference).var.compiled_field.IsLiteral)
icn = new int_const_node((int)(switch_expr as static_compiled_variable_reference).var.compiled_field.GetRawConstantValue(), loc);
//учти здесь модет быть и long!
//-DarkStar Add
if (icn == null)
{
AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
}
return icn;
}
示例14: get_instance
public override function_node get_instance(List<type_node> param_types, bool stop_on_error, location loc)
{
if (generic_parameters_count != param_types.Count)
{
if (stop_on_error)
{
throw new TreeConverter.SimpleSemanticError(loc, "FUNCTION_{0}_DEPEND_FROM_{1}_TYPE_PARAMS", name, this.generic_parameters_count);
}
return null;
}
int num;
TreeConverter.CompilationErrorWithLocation err = generic_parameter_eliminations.check_type_list(param_types, parameters_eliminations, true, out num);
if (err != null)
{
if (stop_on_error)
{
err.loc = loc;
throw err;
}
return null;
}
return generic_convertions.get_function_instance(this, param_types);
}
示例15: CreateTemplateInstance
public string CreateTemplateInstance(List<type_node> instance_params, location loc)
{
SyntaxTree.class_definition cl_def = _type_decl.type_def as SyntaxTree.class_definition;
SyntaxTree.template_type_name ttn = _type_decl.type_name as SyntaxTree.template_type_name;
//if (cl_def == null)
//{
// throw new PascalABCCompiler.TreeConverter.CompilerInternalError("No body definition in template class.");
//}
//if (cl_def.template_args == null || cl_def.template_args.idents == null)
//{
// throw new PascalABCCompiler.TreeConverter.CompilerInternalError("No template arguments in syntax tree.");
//}
List<SyntaxTree.ident> template_formals = (_is_synonym) ?
ttn.template_args.idents : cl_def.template_args.idents;
if (instance_params.Count != template_formals.Count)
{
throw new PascalABCCompiler.TreeConverter.SimpleSemanticError(loc, "TEMPLATE_ARGUMENTS_COUNT_MISMATCH");
}
return GetTemplateInstanceName(instance_params);
}