Пример #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));
        }
Пример #2
0
 public override void visit(procedure_attributes_list _procedure_attributes_list)
 {
     foreach (procedure_attribute pa in _procedure_attributes_list.proc_attributes)
     {
         pa.visit(this);
     }
 }
 public procedure_attributes_list AddModifier(procedure_attributes_list proc_list, proc_attribute modif)
 {
     if (proc_list == null)
     {
         proc_list = new procedure_attributes_list();
     }
     foreach (procedure_attribute attr in proc_list.proc_attributes)
     {
         if (attr.attribute_type == modif)
         {
             return(proc_list);
         }
     }
     proc_list.proc_attributes.Add(new procedure_attribute(modif));
     return(proc_list);
 }
Пример #4
0
 public override void visit(procedure_attributes_list _procedure_attributes_list)
 {
     get_count(_procedure_attributes_list.proc_attributes);
 }
Пример #5
0
 public virtual void visit(procedure_attributes_list _procedure_attributes_list)
 {
     DefaultVisit(_procedure_attributes_list);
 }
Пример #6
0
		public virtual void post_do_visit(procedure_attributes_list _procedure_attributes_list)
		{
		}
Пример #7
0
		public override void visit(procedure_attributes_list _procedure_attributes_list)
		{
			DefaultVisit(_procedure_attributes_list);
			pre_do_visit(_procedure_attributes_list);
			for (int i = 0; i < proc_attributes.Count; i++)
				visit(procedure_attributes_list.proc_attributes[i]);
			post_do_visit(_procedure_attributes_list);
		}
Пример #8
0
        public static procedure_definition BuildShortProcDefinition(formal_parameters fp, procedure_attributes_list att, method_name name, statement st, SourceContext headsc)
        {
            var ff = new procedure_header(fp, att, name, null, headsc);

            return(BuildShortProcFuncDefinition(ff, st));
        }
Пример #9
0
        public static procedure_definition BuildShortFuncDefinition(formal_parameters fp, procedure_attributes_list att, method_name name, type_definition result, expression ex, SourceContext headsc)
        {
            var ff = new function_header(fp, att, name, null, result, headsc);
            procedure_definition pd = BuildShortProcFuncDefinition(ff, new assign("Result", ex, ex.source_context));

            return(pd);
        }
Пример #10
0
 public virtual void visit(procedure_attributes_list _procedure_attributes_list)
 {
 }
		public virtual void visit(procedure_attributes_list _procedure_attributes_list)
		{
			DefaultVisit(_procedure_attributes_list);
		}
Пример #12
0
 public override void visit(procedure_attributes_list _procedure_attributes_list)
 {
     prepare_collection(_procedure_attributes_list.proc_attributes, "attributes");
 }
Пример #13
0
		public override void visit(procedure_attributes_list _procedure_attributes_list)
		{
			executer.visit(_procedure_attributes_list);
			if (_procedure_attributes_list.proc_attributes != null)
			foreach (dynamic x in _procedure_attributes_list.proc_attributes)
				if(x != null)
					this.visit(x);
		}