Esempio n. 1
0
			public MethodTableItem (MethodDef method, Location location)
			{
				flags = 0;
				Method = method;
				LocationList = new ArrayList ();
				LocationList.Add (location);
			}
Esempio n. 2
0
			public FieldTableItem (FieldDef field, Location location)
			{
				flags = 0;
				Field = field;
				LocationList = new ArrayList ();
				LocationList.Add (location);
			}
Esempio n. 3
0
                public CalliInstr (PEAPI.CallConv call_conv, BaseTypeRef ret_type,
				   BaseTypeRef[] param, Location loc)
			: base (loc)
                {
                        this.call_conv = call_conv;
                        this.ret_type = ret_type;
                        this.param = param;
                }
Esempio n. 4
0
		public ILReader (StreamReader reader)
		{
			this.reader = reader;
			putback_stack = new Stack ();
			
			location = new Location ();
			markedLocation = Location.Unknown;
		}
Esempio n. 5
0
 public ClassTableItem (ClassDef klass, Location location)
 {
         flags = 0;
         Class = klass;
         LocationList = new ArrayList ();
         LocationList.Add (location);
         method_table = new MethodTable (klass);
         field_table = new FieldTable (klass);
 }
Esempio n. 6
0
                public static void Warning (Location location, string message)
                {
                        string location_str = " : ";
                        if (location != null)
                                location_str = " (" + location.line + ", " + location.column + ") : ";

                        Console.Error.WriteLine (String.Format ("{0}{1}Warning -- {2}",
                                (file_path != null ? file_path : ""), location_str, message));
                }
Esempio n. 7
0
                public MethodInstr (PEAPI.MethodOp op, BaseMethodRef operand, Location loc)
			: base (loc)
                {
                        this.op = op;
                        this.operand = operand;

                        if (op == PEAPI.MethodOp.newobj || op == PEAPI.MethodOp.callvirt)
                                operand.CallConv |= PEAPI.CallConv.Instance;
                }
Esempio n. 8
0
		public SourceMethod (CompileUnitEntry file, MethodDef method, Location start)
		{
			this.file = file;
			this.method = method;
			this.StartLine = start.line;

			lines = new ArrayList ();
			MarkLocation (start.line, 0);
		}
Esempio n. 9
0
		public Field GetReference (TypeRef type, string name, Location location)
		{
			FieldTableItem item = table[name] as FieldTableItem;
			
			if (item != null) {
				item.LocationList.Add (location);
				return item.Field;
			}
			
			FieldDef field = parent_class.AddField (name, type.Type);
			AddReferenced (name, field, location);

			return field;
		}
Esempio n. 10
0
		public FieldDef AddDefinition (FieldAttr field_attr, string name, 
			TypeRef type, Location location) 
		{
			FieldTableItem item = (FieldTableItem) table[name];
			
			if (item == null) {
				FieldDef field = parent_class.AddField (field_attr, name, type.Type);
				AddDefined (name, field, location);
				return field;
			}
			
			item.Field.AddFieldAttr (field_attr);
			item.Defined = true;
			
			return item.Field;
		}
Esempio n. 11
0
                public TypeDef (PEAPI.TypeAttr attr, string name_space, string name,
                                BaseClassRef parent, ArrayList impl_list, Location location, GenericParameters gen_params, TypeDef outer)
                {
                        this.attr = attr;
                        this.parent = parent;
                        this.impl_list = impl_list;
                        this.gen_params = gen_params;
                        this.outer = outer;
                        this.location = location;

                        field_table = new Hashtable ();
                        field_list = new ArrayList ();

                        method_table = new Hashtable ();
                        method_list = new ArrayList ();

                        size = -1;
                        pack = -1;

                        is_defined = false;
                        is_intransit = false;

                        is_value_class = false;
                        is_enum_class = false;

                        ResolveGenParams ();

                        int lastdot = name.LastIndexOf ('.');
                        /* Namespace . name split should not be done for nested classes */
                        if (lastdot >= 0 && outer == null) {
                                if (name_space == null || name_space == "")
                                        this.name_space = name.Substring (0, lastdot);
                                else
                                        this.name_space = name_space + "." + name.Substring (0, lastdot);
                                this.name = name.Substring (lastdot + 1);
                        } else {
                                this.name_space = name_space;
                                this.name = name;
                        }

                        //Fixup attributes
                        if (IsInterface)
                                this.attr |= PEAPI.TypeAttr.Abstract;
                }
Esempio n. 12
0
                public MethodDef (CodeGen codegen, PEAPI.MethAttr meth_attr,
				  PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr,
				  string name, BaseTypeRef ret_type, ArrayList param_list,
				  Location start, GenericParameters gen_params, TypeDef type_def)
                {
                        this.codegen = codegen;
                        this.meth_attr = meth_attr;
                        this.call_conv = call_conv;
                        this.impl_attr = impl_attr;
                        this.name = name;
                        this.param_list = param_list;
                        this.type_def = type_def;
                        this.gen_params = gen_params;
                        this.ret_param = new ParamDef (PEAPI.ParamAttr.Default, "", ret_type);
                        this.start = (Location) start.Clone ();

                        inst_list = new ArrayList ();
                        label_table = new Hashtable ();
                        labelref_table = new Hashtable ();
                        label_list = new ArrayList ();
                        local_list = new ArrayList ();
                        named_local_tables = new ArrayList ();
                        named_local_tables.Add (new Hashtable ());
                        current_scope_depth = 0;

                        entry_point = false;
                        zero_init = false;
                        init_locals = false;
                        max_stack = -1;
                        pinvoke_info = false;

                        is_defined = false;
                        is_resolved = false;
                        ResolveGenParams ();
                        CreateSignature ();

			codegen.BeginMethodDef (this);

			if (codegen.SymbolWriter != null)
				source = codegen.SymbolWriter.BeginMethod (this, start);
                }
Esempio n. 13
0
                public SimpInstr (PEAPI.Op op, Location loc)
			: base (loc)
                {
                        this.op = op;
                }
Esempio n. 14
0
		protected void AddReferenced (string signature, FieldDef field, Location location)
		{
			FieldTableItem item = new FieldTableItem (field, location);
			
			table[signature] = item;
		}
Esempio n. 15
0
                public TypeInstr (PEAPI.TypeOp op, BaseTypeRef operand, Location loc)
			: base (loc)
                {
                        this.op = op;
                        this.operand = operand;
                }
Esempio n. 16
0
		public void EndMethod (Location end)
		{
			current_method.EndLine = end.line;
			current_method = null;
		}
Esempio n. 17
0
                public FieldTable GetFieldTable (string full_name, Location location)
                {
                        ClassTableItem item = table[full_name] as ClassTableItem;

                        if (item == null) {
                                GetReference (full_name, location);
                                return GetFieldTable (full_name, location);
                        }

                        return item.FieldTable;
                }
Esempio n. 18
0
 public TypeRef (string full_name, bool is_valuetype, Location location, ArrayList conv_list, string sig_mod)
         : base (full_name, is_valuetype, conv_list, sig_mod)
 {
         this.location = location;
 }
Esempio n. 19
0
		public Mono.ILASM.SourceMethod BeginMethod (MethodDef method, Location start)
		{
			current_method = new Mono.ILASM.SourceMethod (current_source, method, start);
			methods.Add (current_method);
			return current_method;
		}
Esempio n. 20
0
                public ClassDef AddDefinition (string name_space, string name,
                        TypeAttr attr, Location location)
                {
                        string full_name;

                        if (name_space != null)
                                full_name = String.Format ("{0}.{1}", name_space, name);
                        else
                                full_name = name;

                        ClassTableItem item = (ClassTableItem) table[full_name];

                        if (item == null) {
                                ClassDef klass = pefile.AddClass (attr, name_space, name);
                                AddDefined (full_name, klass, location);
                                return klass;
                        }

                        item.Class.AddAttribute (attr);
                        item.Defined = true;

                        return item.Class;
                }
Esempio n. 21
0
                public ClassDef AddDefinition (string name_space, string name,
                        TypeAttr attr, Class parent, Location location)
                {
                        string full_name;

                        if (name_space != null)
                                full_name = String.Format ("{0}.{1}", name_space, name);
                        else
                                full_name = name;

                        ClassTableItem item = (ClassTableItem) table[full_name];

                        if (item == null) {
                                ClassDef klass = pefile.AddClass (attr, name_space, name, parent);
                                AddDefined (full_name, klass, location);
                                return klass;
                        }

                        /// TODO: Need to set parent, will need to modify PEAPI for this.
                        item.Class.AddAttribute (attr);
                        item.Defined = true;

                        return item.Class;
                }
Esempio n. 22
0
                public void EndMethodDef (Location location)
                {
			if (symwriter != null)
				symwriter.EndMethod (location);

                        current_methoddef = null;
                }
Esempio n. 23
0
                protected void AddReference (string full_name, ClassDef klass, Location location)
                {
                        if (table.Contains (full_name))
                                return;

                        ClassTableItem item = new ClassTableItem (klass, location);

                        table[full_name] = item;
                }
Esempio n. 24
0
                protected void AddDefined (string full_name, ClassDef klass, Location location)
                {
                        if (table.Contains (full_name))
                                return;

                        ClassTableItem item = new ClassTableItem (klass, location);
                        item.Defined = true;

                        table[full_name] = item;
                }
Esempio n. 25
0
		protected void AddDefined (string signature, FieldDef field, Location location)
		{
			if (table.Contains (signature))
				return; 

			FieldTableItem item = new FieldTableItem (field, location);
			item.Defined = true;

			table[signature] = item;
		}
Esempio n. 26
0
                public FieldInstr (PEAPI.FieldOp op, IFieldRef operand, Location loc)
			: base (loc)
                {
                        this.op = op;
                        this.operand = operand;
                }
Esempio n. 27
0
                public void BeginTypeDef (TypeAttr attr, string name, BaseClassRef parent,
                                ArrayList impl_list, Location location, GenericParameters gen_params)
                {
                        TypeDef outer = null;
                        string cache_name = CacheName (name);
                        if (typedef_stack_top > 0) {
				StringBuilder sb = new StringBuilder ();

				for (int i = 0; i < typedef_stack_top; i++){
					outer = (TypeDef) typedef_stack [i];
					if (i == 0)
						/* Use FullName for outermost class to get the
						   namespace also */
						sb.Append (outer.FullName);
					else
						sb.Append (outer.Name);
					sb.Append ("/");
				}
				sb.Append (name);
				cache_name = sb.ToString ();
                        }

                        TypeDef typedef = type_manager[cache_name];

                        if (typedef != null) {
                                // Class head is allready defined, we are just reopening the class
                                current_customattrtarget = current_typedef = typedef;
                                current_declsectarget = typedef;
                                typedef_stack.Add (current_typedef);
				typedef_stack_top++;
                                return;
                        }

                        typedef = new TypeDef (attr, current_namespace,
                                        name, parent, impl_list, location, gen_params, outer);

                        type_manager[cache_name] = typedef;
                        current_customattrtarget = current_typedef = typedef;
                        current_declsectarget = typedef;
			typedef_stack.Add (typedef);
			typedef_stack_top++;
                }
Esempio n. 28
0
 public TypeRef (string full_name, bool is_valuetype, Location location)
         : this (full_name, is_valuetype, location, null, null)
 {
 }
Esempio n. 29
0
		public ILSyntaxError (string msg, Location loc) : base (msg)
		{
			this.loc = loc.Clone () as Location;
		}
Esempio n. 30
0
                public Class GetReference (string full_name, Location location)
                {
                        ClassTableItem item = table[full_name] as ClassTableItem;

                        if (item != null) {
                                item.LocationList.Add (location);
                                return item.Class;
                        }

                        string name_space, name;
                        GetNameAndNamespace (full_name, out name_space, out name);
                        ClassDef klass = pefile.AddClass (DefaultAttr, name_space, name);
                        AddReference (full_name, klass, location);

                        return klass;
                }