コード例 #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
ファイル: MetadataMethod.cs プロジェクト: jspuij/fluentlang
 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;
 }