예제 #1
0
 public MetadataNamedInterface(
     InterfaceAttribute attribute,
     SourceSymbolContext sourceSymbolContext,
     DiagnosticBag diagnostics) : base(diagnostics)
 {
     _anonymousSourceInterface = new SourceAnonymousInterface(
         Utils.Parse(
             attribute.AnonymousInterfaceDeclaration,
             p => p.anonymous_interface_declaration_metadata().anonymous_interface_declaration(),
             _diagnostics),
         sourceSymbolContext.WithTypeParameters(() => TypeParameters),
         true,
         _diagnostics);
     _attribute           = attribute;
     _sourceSymbolContext = sourceSymbolContext;
     FullyQualifiedName   = QualifiedName.Parse(attribute.FullyQualifiedName);
     _typeParameters      = new Lazy <ImmutableArray <ITypeParameter> >(GenerateTypeParameters);
 }
예제 #2
0
        private IReadOnlyDictionary <QualifiedName, IInterface> GenerateInterfaces()
        {
            var context = new SourceSymbolContext(
                scope: null,
                assembly: this,
                ImmutableArray <QualifiedName> .Empty,
                nameSpace: null,
                () => ImmutableArray <ITypeParameter> .Empty);

            return
                (_assembly
                 .GetAttributes <InterfaceAttribute>()
                 .Select(x => (IInterface) new MetadataNamedInterface(
                             x,
                             context,
                             _diagnostics))
                 .ToDictionary(x => x.FullyQualifiedName !));
        }
예제 #3
0
 public MetadataMethod(
     IAssembly metadataAssembly,
     DiagnosticBag diagnostics,
     MethodSignatureAttribute attribute) : base(diagnostics)
 {
     DeclaringAssembly = metadataAssembly;
     _attribute        = attribute;
     _methodSignature  = Utils.Parse(
         attribute.Signature,
         p => p.method_signature_metadata(),
         _diagnostics);
     _sourceSymbolContext = new SourceSymbolContext(null, DeclaringAssembly, ImmutableArray <QualifiedName> .Empty, null, () => ImmutableArray <ITypeParameter> .Empty);
     _sourceSymbolContextWithTypeParams = _sourceSymbolContext.WithTypeParameters(() => TypeParameters);
     FullyQualifiedName  = _methodSignature.qualified_name().GetQualifiedName();
     _typeParameters     = new Lazy <ImmutableArray <ITypeParameter> >(GenerateTypeParameters);
     _returnType         = new Lazy <IType>(GenerateReturnType);
     _parameters         = new Lazy <ImmutableArray <IParameter> >(GenerateParameters);
     _requiredMethodKeys = new Lazy <ImmutableArray <MethodOrInterfaceMethod> >(GenerateRequiredMethodKeys);
 }
예제 #4
0
 public MethodBodySymbolContext WithScope(IMethod method)
 => new MethodBodySymbolContext(SourceSymbolContext.WithScope(method), Locals.AddRange(method.ParameterLocals), CurrentStatement);
예제 #5
0
 private MethodBodySymbolContext(SourceSymbolContext sourceSymbolContext, ImmutableList <ILocal> locals, IStatement?currentStatement)
 {
     SourceSymbolContext = sourceSymbolContext;
     Locals           = locals;
     CurrentStatement = currentStatement;
 }
예제 #6
0
 public MethodBodySymbolContext(SourceSymbolContext sourceSymbolContext)
 {
     SourceSymbolContext = sourceSymbolContext;
     Locals = ImmutableList <ILocal> .Empty;
 }