コード例 #1
0
        /// <exception cref="InvalidMarkup"></exception>
        /// <exception cref="CyclicClassHierarchy"></exception>
        /// <exception cref="TypeNotFound"></exception>
        /// <exception cref="UnknownBaseClass"></exception>
        /// <exception cref="UnknownMemberType"></exception>
        /// <exception cref="TypeNameCollision"></exception>
        IImmutableList <IDataType> CreateGhostDataTypes(System.Collections.Immutable.ImmutableList <UxFileContents> documents)
        {
            var parsedDocuments = ParseDocuments(documents);
            var nodes           = parsedDocuments.SelectMany(OuterClassNode.GetOuterClassNodes);
            var orderedNodes    = OrderByDependencies(nodes);

            var generatedDataTypes = new Dictionary <string, GhostDataType>();

            foreach (var node in orderedNodes)
            {
                var n        = node;
                var baseType = TryGetDataType(node.BaseTypeName, generatedDataTypes)
                               .OrThrow(new UnknownBaseClass(node.BaseTypeName, n.GeneratedTypeName, n.DeclaringFile));

                generatedDataTypes[node.GeneratedTypeName] = new GhostDataType(
                    n.GeneratedTypeName,
                    baseType,

                    globalResources: self => n.GlobalResources.Select(
                        r => new GhostGlobalResource(
                            fullPath: n.GeneratedTypeName + "." + r.Name,
                            dataType: GetMemberDataType(r, n, generatedDataTypes),
                            globalSymbol: r.Name)),

                    declaredProperties: self => n.Properties.Select(
                        p => new GhostProperty(
                            name: p.Name,
                            dataType: GetMemberDataType(p, n, generatedDataTypes),
                            declaringType: self)));
            }

            foreach (var ghostType in generatedDataTypes.Values)
            {
                ghostType.CompleteType();
            }

            return(ImmutableList.ToImmutableList <IDataType>(generatedDataTypes.Values));
        }
コード例 #2
0
 /// <exception cref="InvalidMarkup"></exception>
 /// <exception cref="CyclicClassHierarchy"></exception>
 /// <exception cref="TypeNotFound"></exception>
 /// <exception cref="UnknownBaseClass"></exception>
 /// <exception cref="UnknownMemberType"></exception>
 /// <exception cref="UnknownError"></exception>
 /// <exception cref="UserCodeContainsErrors">(Base exception type for all exceptions above)</exception>
 /// <exception cref="TypeNameCollision"></exception>
 public Project ParseDocument(System.Collections.Immutable.ImmutableList <UxFileContents> documents, IObserver <IBinaryMessage> buildEvents, Guid buildId)
 {
     return(_parser.Parse(
                documents: documents,
                reporter: new MarkupErrorLog(buildEvents, buildId)));
 }
コード例 #3
0
 /// <exception cref="InvalidMarkup"></exception>
 static IImmutableList <ParsedDocument> ParseDocuments(System.Collections.Immutable.ImmutableList <UxFileContents> documents)
 {
     return(ImmutableList.ToImmutableList(
                documents.Select(doc => new ParsedDocument(ParseXml(doc), doc.Path))));
 }
コード例 #4
0
 /// <exception cref="InvalidMarkup"></exception>
 /// <exception cref="CyclicClassHierarchy"></exception>
 /// <exception cref="TypeNotFound"></exception>
 /// <exception cref="UnknownBaseClass"></exception>
 /// <exception cref="UnknownMemberType"></exception>
 /// <exception cref="TypeNameCollision"></exception>
 public IDataTypeProvider CreateGhostCompiler(System.Collections.Immutable.ImmutableList <UxFileContents> documents)
 {
     return(new GhostCompiler(_realCompiler, CreateGhostDataTypes(documents)));
 }
コード例 #5
0
 public void Report(T value)
 {
     _reportedProgress = _reportedProgress.Add(value);
     _progress.Report(value);
 }