syntax_tree_visitor_semcheck_helper.cs удалил
This commit is contained in:
parent
6779e4d62c
commit
dd2f889c86
|
|
@ -413,12 +413,12 @@
|
|||
</Node>
|
||||
<Node Name="Реализуем тип (integer,integer)" NL="0" NG="0">
|
||||
<Items>
|
||||
<Node Name="void visit(enum_type_definition" NL="0" NG="0">
|
||||
<Node Name="void visit(enum_type_definition" NL="0,9619141" NG="-1">
|
||||
<FileName>\treeconverter\treeconversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>public override void visit(SyntaxTree.enum_type_definition _enum_type_definition)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . enum_type_definition _enum_type_definition )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . AbstractVisitor</i>
|
||||
<i Type="ClassOrNamespace">public partial class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
|
|
|
|||
|
|
@ -19227,8 +19227,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public override void visit(SyntaxTree.slice_expr sl)
|
||||
{
|
||||
//AddError(get_location(sl), "SUGARED_NODE_{0}_IN_SYNTAX_TREE_VISITOR", sl.GetType().Name);
|
||||
AddError(get_location(sl), "SUGARED_NODE_{0}_IN_SYNTAX_TREE_VISITOR", sl.GetType().Name);
|
||||
|
||||
/*
|
||||
// Преобразуется в вызов a.SystemSlice(situation,from,to,step)
|
||||
// Тип a должен быть array of T, List<T> или string
|
||||
semcheck(sl);
|
||||
|
|
@ -19237,13 +19238,13 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var el = construct_expression_list_for_slice_expr(sl);
|
||||
var mc = new method_call(new dot_node(sl.v, new ident("SystemSlice", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
|
||||
visit(mc);
|
||||
visit(mc);*/
|
||||
}
|
||||
|
||||
public override void visit(SyntaxTree.slice_expr_question sl)
|
||||
{
|
||||
//AddError(get_location(sl), "SUGARED_NODE_{0}_IN_SYNTAX_TREE_VISITOR", sl.GetType().Name);
|
||||
|
||||
AddError(get_location(sl), "SUGARED_NODE_{0}_IN_SYNTAX_TREE_VISITOR", sl.GetType().Name);
|
||||
/*
|
||||
// Преобразуется в вызов a.SystemSlice(situation,from,to,step)
|
||||
// Тип a должен быть array of T, List<T> или string
|
||||
semcheck(sl);
|
||||
|
|
@ -19251,7 +19252,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var el = construct_expression_list_for_slice_expr(sl);
|
||||
var mc = new method_call(new dot_node(sl.v, new ident("SystemSliceQuestion", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
|
||||
visit(mc);
|
||||
visit(mc);*/
|
||||
}
|
||||
|
||||
// frninja 04/03/16 - для yield
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PascalABCCompiler.SyntaxTree;
|
||||
using PascalABCCompiler.TreeRealization;
|
||||
|
||||
namespace PascalABCCompiler.TreeConverter
|
||||
{
|
||||
public partial class syntax_tree_visitor
|
||||
{
|
||||
void semcheck_slice_expr_helper(SyntaxTree.slice_expr sl)
|
||||
{
|
||||
var semvar = convert_strong(sl.v);
|
||||
if (semvar is typed_expression)
|
||||
semvar = convert_typed_expression_to_function_call(semvar as typed_expression);
|
||||
|
||||
var t = ConvertSemanticTypeNodeToNETType(semvar.type);
|
||||
|
||||
var IsSlicedType = 0; // проверим, является ли semvar.type динамическим массивом, списком List или строкой
|
||||
// semvar.type должен быть array of T, List<T> или string
|
||||
if (t == null)
|
||||
IsSlicedType = 0; // можно ничего не присваивать :)
|
||||
else if (t.IsArray)
|
||||
IsSlicedType = 1;
|
||||
else if (t == typeof(System.String))
|
||||
IsSlicedType = 2;
|
||||
else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(System.Collections.Generic.List<>))
|
||||
IsSlicedType = 3;
|
||||
|
||||
if (IsSlicedType == 0)
|
||||
AddError(get_location(sl.v), "BAD_SLICE_OBJECT");
|
||||
|
||||
var semfrom = convert_strong(sl.from);
|
||||
var b = convertion_data_and_alghoritms.can_convert_type(semfrom, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.from), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
var semto = convert_strong(sl.to);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semto, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.to), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
if (sl.step != null)
|
||||
{
|
||||
var semstep = convert_strong(sl.step);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semstep, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.step), "INTEGER_VALUE_EXPECTED");
|
||||
}
|
||||
}
|
||||
public void semcheck(SyntaxTree.slice_expr sl)
|
||||
{
|
||||
semcheck_slice_expr_helper(sl);
|
||||
}
|
||||
public void semcheck(SyntaxTree.slice_expr_question sl)
|
||||
{
|
||||
semcheck_slice_expr_helper(sl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in a new issue