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); }
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 !)); }
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); }
public MethodBodySymbolContext WithScope(IMethod method) => new MethodBodySymbolContext(SourceSymbolContext.WithScope(method), Locals.AddRange(method.ParameterLocals), CurrentStatement);
private MethodBodySymbolContext(SourceSymbolContext sourceSymbolContext, ImmutableList <ILocal> locals, IStatement?currentStatement) { SourceSymbolContext = sourceSymbolContext; Locals = locals; CurrentStatement = currentStatement; }
public MethodBodySymbolContext(SourceSymbolContext sourceSymbolContext) { SourceSymbolContext = sourceSymbolContext; Locals = ImmutableList <ILocal> .Empty; }