~ubuntu-branches/ubuntu/saucy/monodevelop/saucy-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.MacDev/ObjCIntegration/NSObjectInfoService.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2012-06-22 20:35:35 UTC
  • mfrom: (10.3.2)
  • Revision ID: package-import@ubuntu.com-20120622203535-zrozwvcf6kfk6l6i
Tags: 3.0.3.2+dfsg-1
* [3fd89ae] Imported Upstream version 3.0.3.2+dfsg
* [379a680] Remove old patches we haven't used for ages from git.
* [d71161d] Remove correct_paths_in_monodevelop-core-addins.pc.patch.
  Upstream claim to have fixed this by moving assembly install locations.
* [15dbfb9] Fix install location for MonoDevelop.Gettext.dll.config.
* [26eb434] Fix install location for MonoDevelop.SourceEditor2.dll.config.
* [4169974] Upstream commit 53282c9 which finally reconciles the 
  MonoDevelop.Gettext.dll install location with the 
  monodevelop-core-addins.pc location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        {
46
46
                //static readonly Regex frameworkRegex = new Regex ("#import\\s+<([A-Z][A-Za-z]*)/([A-Z][A-Za-z]*)\\.h>", RegexOptions.Compiled);
47
47
                static readonly Regex typeInfoRegex = new Regex ("@(interface|protocol)\\s+(\\w*)\\s*:\\s*(\\w*)", RegexOptions.Compiled);
48
 
                static readonly Regex ibRegex = new Regex ("(- \\(IBAction\\)|IBOutlet)([^;]*);", RegexOptions.Compiled);
 
48
                static readonly Regex ibRegex = new Regex ("(-\\s*\\(IBAction\\)|IBOutlet)\\s*([^;]*);", RegexOptions.Compiled);
49
49
                static readonly char[] colonChar = { ':' };
50
50
                static readonly char[] whitespaceChars = { ' ', '\t', '\n', '\r' };
51
51
                static readonly char[] splitActionParamsChars = { ' ', '\t', '\n', '\r', '*', '(', ')' };
146
146
                        //FIXME: only emit this for the wrapper NS
147
147
//                      yield return new NSObjectTypeInfo ("NSObject", nso.GetDefinition ().FullName, null, null, false, false, false);
148
148
                        int cnt = 0, infcnt=0, models=0;
149
 
                        
 
149
                        nso = assembly.Compilation.Import (nso);
150
150
                        foreach (var contextType in assembly.GetAllTypeDefinitions ()) {
151
 
                                var importedType = dom.Compilation.Import (contextType);
152
 
                                if (importedType.IsDerivedFrom (nso)) {
153
 
                                        var info = ConvertType (dom, importedType);
 
151
                                if (contextType.IsDerivedFrom (nso)) {
 
152
                                        var info = ConvertType (dom, contextType);
154
153
                                        if (info != null)
155
154
                                                yield return info;
156
155
                                }
245
244
                                                if (!attType.Equals (Resolve (dom, exportAttType)))
246
245
                                                        continue;
247
246
                                        }
248
 
                                        bool isDesigner = MonoDevelop.DesignerSupport.CodeBehind.IsDesignerFile (meth.Region.FileName);
 
247
 
 
248
                                        bool isDesigner = meth.Parts.Any (part => MonoDevelop.DesignerSupport.CodeBehind.IsDesignerFile (part.Region.FileName));
249
249
                                        //only support Export from old designer files, user code must be IBAction
250
250
                                        if (!isDesigner && !isIBAction)
251
251
                                                continue;
265
265
                                                        label = null;
266
266
                                                action.Parameters.Add (new IBActionParameter (label, param.Name, null, param.Type.ReflectionName));
267
267
                                        }
268
 
                                        if (MonoDevelop.DesignerSupport.CodeBehind.IsDesignerFile (meth.Region.FileName))
 
268
                                        if (meth.Parts.Any (part => MonoDevelop.DesignerSupport.CodeBehind.IsDesignerFile (part.Region.FileName)))
269
269
                                                action.IsDesigner = true;
270
270
                                        info.Actions.Add (action);
271
271
                                        break;
307
307
                                var def = match.Groups[2].Value;
308
308
                                if (kind == "IBOutlet") {
309
309
                                        var split = def.Split (whitespaceChars, StringSplitOptions.RemoveEmptyEntries);
310
 
                                        if (split.Length != 2)
311
 
                                                continue;
312
 
                                        string objcName = split[1].TrimStart ('*');
313
310
                                        string objcType = split[0].TrimEnd ('*');
314
 
                                        if (objcType == "id")
315
 
                                                objcType = "NSObject";
316
 
                                        if (string.IsNullOrEmpty (objcType)) {
 
311
                                        string objcName = null;
 
312
 
 
313
                                        for (int i = 1; i < split.Length; i++) {
 
314
                                                objcName = split[i].TrimStart ('*');
 
315
                                                if (string.IsNullOrEmpty (objcName))
 
316
                                                        continue;
 
317
 
 
318
                                                if (i + 1 < split.Length) {
 
319
                                                        // This is a bad sign... what tokens are after the name??
 
320
                                                        objcName = null;
 
321
                                                        break;
 
322
                                                }
 
323
                                        }
 
324
 
 
325
                                        if (string.IsNullOrEmpty (objcType) || string.IsNullOrEmpty (objcName)) {
317
326
                                                MessageService.ShowError (GettextCatalog.GetString ("Error while parsing header file."),
318
327
                                                        string.Format (GettextCatalog.GetString ("The definition '{0}' can't be parsed."), def));
 
328
 
 
329
                                                // We can't recover if objcName is empty...
 
330
                                                if (string.IsNullOrEmpty (objcName))
 
331
                                                        continue;
 
332
 
 
333
                                                // We can try using NSObject...
319
334
                                                objcType = "NSObject";
320
335
                                        }
321
 
                                        
 
336
 
 
337
                                        if (objcType == "id")
 
338
                                                objcType = "NSObject";
 
339
 
322
340
                                        IBOutlet outlet = new IBOutlet (objcName, objcName, objcType, null);
323
341
                                        outlet.IsDesigner = true;
324
342