Beispiel #1
0
        private CapnpType _ResolveImport(CapnpImport import)
        {
            if (_GetImportContents == null)
            {
                throw new Exception("import attempted but no way to resolve it");
            }

            var source = _GetImportContents(import.File);

            var importedType = import.Type;

            var importParser = new CapnpParser(source);
            var parsedSource = importParser.Parse();

            parsedSource = importParser.ProcessParsedSource(parsedSource, _GetImportContents);

            // No type specified, so return the module for later perusal.
            if (importedType == null)
            {
                return(parsedSource);
            }

            if (importedType is CapnpReference)
            {
                var @ref = (CapnpReference)importedType;
                return(parsedSource.ResolveFullName(@ref.FullName));
            }
            else
            {
                Debug.Assert(false);
            }

            return(importedType);
        }
 protected internal virtual CapnpType VisitImport(CapnpImport import)
 {
     import.Type = Visit(import.Type);
     return(import);
 }
Beispiel #3
0
 protected internal override CapnpType VisitImport(CapnpImport import)
 {
     throw new InvalidOperationException("unexpected remaining import");
 }