Example #1
0
        void CompileRequirements(ExtensionEntity ext)
        {
            List <Element> elms;

            if (ext.Requirements.TryGetValue("Entity", out elms))
            {
                foreach (var e in elms)
                {
                    ext.RequiredEntities.Add(_ilf.GetEntity(e.Source, e.String, e.Usings));
                }
            }

            if (ext.Requirements.TryGetValue("Template", out elms))
            {
                foreach (var e in elms)
                {
                    ExtensionEntity template;
                    if (!_root.Templates.TryGetValue(e.String, out template))
                    {
                        Log.Error(e.Source, ErrorCode.E0000, "Template " + e.String.Quote() + " is not defined (on this backend)");
                    }
                    else
                    {
                        ext.RequiredTemplates.Add(template);
                    }
                }
            }
        }
Example #2
0
        void CompileRequirements(ExtensionEntity ext)
        {
            ListDictionary <string, Element> deprecated = null;

            foreach (var e in ext.Requirements)
            {
                string key;
                if (_deprecated.TryGetValue(e.Key, out key))
                {
                    foreach (var req in e.Value)
                    {
                        Log.Warning(req.Source, ErrorCode.W0000, e.Key.Quote() + " is deprecated -- please replace with " + key.Quote());
                    }

                    if (deprecated == null)
                    {
                        deprecated = new ListDictionary <string, Element>();
                    }

                    deprecated.Add(key, e.Value);
                }
            }

            if (deprecated != null)
            {
                foreach (var e in deprecated)
                {
                    ext.Requirements.AddRange(e.Key, e.Value);
                }
            }

            List <Element> elms;

            if (ext.Requirements.TryGetValue("Entity", out elms))
            {
                foreach (var e in elms)
                {
                    ext.RequiredEntities.Add(_ilf.GetEntity(e.Source, e.String, e.Usings));
                }
            }

            if (ext.Requirements.TryGetValue("Template", out elms))
            {
                foreach (var e in elms)
                {
                    ExtensionEntity template;
                    if (!_root.Templates.TryGetValue(e.String, out template))
                    {
                        Log.Error(e.Source, ErrorCode.E0000, "Template " + e.String.Quote() + " is not defined (on this backend)");
                    }
                    else
                    {
                        ext.RequiredTemplates.Add(template);
                    }
                }
            }
        }
Example #3
0
 void EnsureInitialized(Source source, Function f)
 {
     Helpers.CacheContext(f, source);
     if (!_initialized)
     {
         _initialized   = true;
         _objCObject    = ILFactory.GetType("global::ObjC.Object");
         _objCID        = ILFactory.GetType("global::ObjC.ID");
         _intPtr        = ILFactory.GetType("global::Uno.IntPtr");
         _getHandle     = (Method)ILFactory.GetEntity("global::ObjC.Object.GetHandle(" + Helpers.FullGlobalName(_objCObject) + ")");
         _newObjCObject = (Method)ILFactory.GetEntity(Helpers.FullGlobalName(_objCObject) + ".Create(" + Helpers.FullGlobalName(_objCID) + ")");
     }
 }
Example #4
0
 public ILAnalyzer(CompilerPass parent)
     : base(parent)
 {
     _objectGetHashCode = ILFactory.GetEntity("object.GetHashCode()") as Method;
     _objectEquals      = ILFactory.GetEntity("object.Equals(object)") as Method;
 }
Example #5
0
 void AddFunction(string signature, CallWriter writer = null)
 {
     Functions.Add((Function)ILFactory.GetEntity(signature), writer);
 }