This commit is contained in:
Бондарев Иван 2016-07-22 18:17:10 +02:00
parent 7200247ee8
commit 3e8a9720df
2 changed files with 8 additions and 10 deletions

View file

@ -617,13 +617,17 @@ namespace PascalABCCompiler.TreeConverter
if (pct.second!=null)
{
throw new TwoTypeConversionsPossible(en,pct.first,pct.second);
AddError(new TwoTypeConversionsPossible(en,pct.first,pct.second));
}
if (pct.first==null)
{
if (to is delegated_methods && (to as delegated_methods).empty_param_method != null)
{
return convert_type(en, (to as delegated_methods).empty_param_method.ret_type, loc);
}
en.location = loc;
throw new CanNotConvertTypes(en,en.type,to,loc);
AddError(new CanNotConvertTypes(en, en.type, to, loc));
}
#if (DEBUG)
@ -636,13 +640,7 @@ namespace PascalABCCompiler.TreeConverter
public static function_node get_empty_conversion(type_node from_type, type_node to_type, bool with_compile_time_executor)
{
basic_function_node bfn = null;
/*if (to_type == SystemLibrary.SystemLibrary.object_type && from_type.is_value_type)
{
bfn = new basic_function_node(SemanticTree.basic_function_type.objtoobj, from_type, false);
with_compile_time_executor = false;
}
else*/
bfn = new basic_function_node(SemanticTree.basic_function_type.none, to_type, false);
bfn = new basic_function_node(SemanticTree.basic_function_type.none, to_type, false);
bfn.parameters.AddElement(new basic_parameter("expr", from_type, SemanticTree.parameter_type.value, bfn));
if (with_compile_time_executor)
bfn.compile_time_executor = SystemLibrary.SystemLibrary.delegated_empty_method;

View file

@ -12915,7 +12915,7 @@ namespace PascalABCCompiler.TreeConverter
tn = del;
expr = convertion_data_and_alghoritms.explicit_convert_type(expr, del);
expr.type = tn;
constant = new common_constructor_call_as_constant(expr as common_constructor_call, null);
constant = new common_constructor_call_as_constant(expr as common_constructor_call, loc);
}
}
}