示例#1
0
 private void CompileFileIncludes(CompilationData data)
 {
     /*foreach (string include in data.SourceContent.Includes)
     {
         //
         // Todo: process the includes
     }*/
 }
示例#2
0
        private void CompileFile(CompilationData data)
        {
            if (data.SourceContent.Classes != null)
            {
                foreach (TempClass @class in data.SourceContent.Classes)
                {
                    SharpClass sharpClass = this.CompileClass(data, @class);
                    data.TargetContent.AddClass(sharpClass);
                }
            }

            this.CompileFileIncludes(data);
        }
示例#3
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;
        }
示例#4
0
 private string CompileClassInheritanceString(CompilationData data, IList<string> types)
 {
     return string.Join(", ", types);
 }