public TypeManager(ResourceTypeRegistrar resourceTypeRegistrar, IReadOnlyDictionary <SyntaxBase, Symbol> bindings, IReadOnlyDictionary <SyntaxBase, ImmutableArray <DeclaredSymbol> > cyclesBySyntax) { // bindings will be modified by name binding after this object is created // so we can't make an immutable copy here // (using the IReadOnlyDictionary to prevent accidental mutation) this.typeAssignmentVisitor = new TypeAssignmentVisitor(resourceTypeRegistrar, this, bindings, cyclesBySyntax); }
public TypeManager(IFeatureProvider features, IBinder binder, IFileResolver fileResolver) { // bindings will be modified by name binding after this object is created // so we can't make an immutable copy here // (using the IReadOnlyDictionary to prevent accidental mutation) this.typeAssignmentVisitor = new TypeAssignmentVisitor(this, features, binder, fileResolver); this.declaredTypeManager = new DeclaredTypeManager(this, binder); }
public TypeManager(IResourceTypeProvider resourceTypeProvider, IReadOnlyDictionary <SyntaxBase, Symbol> bindings, IReadOnlyDictionary <DeclaredSymbol, ImmutableArray <DeclaredSymbol> > cyclesBySymbol, SyntaxHierarchy hierarchy, ResourceScopeType targetScope) { this.ResourceTypeProvider = resourceTypeProvider; // bindings will be modified by name binding after this object is created // so we can't make an immutable copy here // (using the IReadOnlyDictionary to prevent accidental mutation) this.typeAssignmentVisitor = new TypeAssignmentVisitor(resourceTypeProvider, this, bindings, cyclesBySymbol, hierarchy, targetScope); this.declaredTypeManager = new DeclaredTypeManager(hierarchy, this, resourceTypeProvider, bindings, cyclesBySymbol, targetScope); }
public static (DeclaredSymbol?, ObjectType?) ExtractResourceOrModuleSymbolAndBodyObj(SemanticModel model, VariableAccessSyntax syntax) { var baseSymbol = model.GetSymbolInfo(syntax); switch (baseSymbol) { case ResourceSymbol: case ModuleSymbol: var declaredSymbol = (DeclaredSymbol)baseSymbol; var unwrapped = TypeAssignmentVisitor.UnwrapType(declaredSymbol.Type); return(declaredSymbol, unwrapped is ObjectType ? (ObjectType)unwrapped : null); } return(null, null); }
public override void VisitInstanceFunctionCallSyntax(InstanceFunctionCallSyntax syntax) { if (this.model.Binder.GetParent(syntax) is DecoratorSyntax) { return; } var baseType = this.model.TypeManager.GetTypeInfo(syntax.BaseExpression); if (TypeAssignmentVisitor.UnwrapType(baseType) is not ObjectType objectType) { return; } var symbol = SymbolValidator.ResolveObjectQualifiedFunctionWithoutValidatingFlags( objectType.MethodResolver.TryGetSymbol(syntax.Name), syntax.Name, objectType); if (symbol is not FunctionSymbol functionSymbol) { return; } var currentDeployTimeConstantScopeSyntax = this.deployTimeConstantScopeSyntax; if (functionSymbol.FunctionFlags.HasFlag(FunctionFlags.RequiresInlining)) { this.deployTimeConstantScopeSyntax = syntax; } base.VisitInstanceFunctionCallSyntax(syntax); if (this.errorSyntax is not null) { this.AppendError(); } this.deployTimeConstantScopeSyntax = currentDeployTimeConstantScopeSyntax; }