示例#1
0
        public static procedure_definition BuildToStringFuncForAutoClass(List <ident> names)
        {
            var pal = new procedure_attributes_list(proc_attribute.attr_override);
            var fp  = new formal_parameters();
            var ff  = new function_header("ToString", "string", fp, pal);

            var      cleft  = new char_const('(');
            var      cright = new char_const(')');
            var      ccomma = new char_const(',');
            bin_expr ex     = new bin_expr(cleft, cright, Operators.Plus);

            for (var i = 0; i < names.Count; i++)
            {
                var dn     = new dot_node(names[i], new ident("ToString"));
                var asnode = new typecast_node(names[i], new named_type_reference("object"), op_typecast.as_op);
                var eqnode = new bin_expr(asnode, new nil_const(), Operators.Equal);
                var expr   = new question_colon_expression(eqnode, new string_const("nil"), dn);
                ex.left = new bin_expr(ex.left, expr, Operators.Plus);
                if (i < names.Count - 1)
                {
                    ex.left = new bin_expr(ex.left, ccomma, Operators.Plus);
                }
            }
            var ass = new assign("Result", ex);

            return(BuildShortProcFuncDefinitionNoSC(ff, ass));
        }
        public typecast_node NewAsIsExpr(syntax_tree_node term, op_typecast typecast_op, type_definition simple_or_template_type_reference, LexLocation loc)
        {
            var naie = new typecast_node((addressed_value)term, simple_or_template_type_reference, typecast_op, loc);

            if (!(term is addressed_value))
            {
                parsertools.errors.Add(new bad_operand_type(parsertools.CurrentFileName, term.source_context, naie));
            }
            return(naie);
        }
        public typecast_node NewAsIsConstexpr(expression constterm, op_typecast typecastop, type_definition tdef, LexLocation loc)
        {
            var naic = new typecast_node(constterm as addressed_value, tdef, typecastop, loc);

            if (!(constterm is addressed_value))
            {
                parsertools.errors.Add(new bad_operand_type(parsertools.CurrentFileName, constterm.source_context, naic));
            }
            return(naic);
        }
示例#4
0
 public override void visit(typecast_node _node)
 {
     text = _node.cast_op.ToString();
 }
示例#5
0
 public virtual void visit(typecast_node _typecast_node)
 {
     DefaultVisit(_typecast_node);
 }
示例#6
0
		public virtual void post_do_visit(typecast_node _typecast_node)
		{
		}
示例#7
0
		public override void visit(typecast_node _typecast_node)
		{
			DefaultVisit(_typecast_node);
			pre_do_visit(_typecast_node);
			visit(typecast_node.expr);
			visit(typecast_node.type_def);
			post_do_visit(_typecast_node);
		}
示例#8
0
 public virtual void visit(typecast_node _typecast_node)
 {
 }
示例#9
0
 public override void visit(typecast_node _typecast_node)
 {
     throw new NotImplementedException();
 }
示例#10
0
		public virtual void visit(typecast_node _typecast_node)
		{
		}
		public virtual void visit(typecast_node _typecast_node)
		{
			DefaultVisit(_typecast_node);
		}
示例#12
0
 public override void visit(typecast_node _node)
 {
     prepare_node(_node.expr, "expr");
     prepare_node(_node.type_def, "type_def");
 }
示例#13
0
		public override void visit(typecast_node _typecast_node)
		{
			executer.visit(_typecast_node);
			if (_typecast_node.expr != null)
				this.visit((dynamic)_typecast_node.expr);
			if (_typecast_node.type_def != null)
				this.visit((dynamic)_typecast_node.type_def);
			if (_typecast_node.attributes != null)
				this.visit((dynamic)_typecast_node.attributes);
		}