Esempio n. 1
0
        private SharpClass CompileClass(CompilationData data, TempClass @class)
        {
            var result = new SharpClass { Name = @class.Name };

            switch (@class.ClassType)
            {
                case TempClassType.Interface:
                    {
                        result.IsInterface = true;
                        break;
                    }

                case TempClassType.Class:
                    {
                        break;
                    }

                default:
                    {
                        throw new NotImplementedException();
                    }
            }

            // Get the attributes from the intermediate
            IList<TempAttribute> attributes = this.GetAttributes(@class.Attributes);

            // Ensure the class has an accessor, public is default
            if (!attributes.Contains(TempAttribute.Private) && !attributes.Contains(TempAttribute.Protected)
                && !attributes.Contains(TempAttribute.Public))
            {
                attributes.Add(TempAttribute.Public);
            }

            // Compile the info and add it to the result
            result.Attributes = this.CompileClassAttributeString(attributes);
            if (@class.Extends != null)
            {
                result.Inheritance = this.CompileClassInheritanceString(data, @class.Extends);
            }

            if (@class.Inherits != null)
            {
                result.Interfaces = this.CompileClassInheritanceString(data, @class.Inherits);
            }

            return result;
        }
Esempio n. 2
0
 public void AddClass(SharpClass @class)
 {
     this.classes.Add(@class);
 }