private BindFunctionDeclaration ( FunctionDeclarationSyntax declaration, |
||
declaration | FunctionDeclarationSyntax | |
parent | ||
return |
private BoundInterfaceType BindInterfaceDeclaration(InterfaceTypeSyntax declaration, Symbol parent) { var interfaceSymbol = new InterfaceSymbol(declaration, parent); AddSymbol(interfaceSymbol, declaration.Name.SourceRange); var methods = new List <BoundFunction>(); var interfaceBinder = new Binder(_sharedBinderState, this); foreach (var memberSyntax in declaration.Methods) { methods.Add(interfaceBinder.Bind(memberSyntax, x => interfaceBinder.BindFunctionDeclaration(x, interfaceSymbol))); } foreach (var member in interfaceBinder.LocalSymbols.Values.SelectMany(x => x)) { interfaceSymbol.AddMember(member); } return(new BoundInterfaceType(interfaceSymbol, methods.ToImmutableArray())); }
private BoundInterfaceType BindInterfaceDeclaration(InterfaceTypeSyntax declaration, Symbol parent) { var interfaceSymbol = new InterfaceSymbol(declaration, parent); AddSymbol(interfaceSymbol, declaration.Name.Span); var methods = new List<BoundFunction>(); var interfaceBinder = new Binder(_sharedBinderState, this); foreach (var memberSyntax in declaration.Methods) methods.Add(interfaceBinder.Bind(memberSyntax, x => interfaceBinder.BindFunctionDeclaration(x, interfaceSymbol))); foreach (var member in interfaceBinder.LocalSymbols.Values.SelectMany(x => x)) interfaceSymbol.AddMember(member); return new BoundInterfaceType(interfaceSymbol, methods.ToImmutableArray()); }
private BoundClassType BindClassDeclaration(ClassTypeSyntax declaration, Symbol parent) { ClassOrStructSymbol baseType; List<InterfaceSymbol> baseInterfaces; BindBaseList(declaration.BaseList, parent, out baseType, out baseInterfaces); var classBinder = new Binder(_sharedBinderState, this); var classSymbol = new ClassSymbol(declaration, parent, baseType, baseInterfaces.ToImmutableArray(), classBinder); AddSymbol(classSymbol, declaration.Name.Span); var members = new List<BoundNode>(); foreach (var memberSyntax in declaration.Members) { switch (memberSyntax.Kind) { case SyntaxKind.VariableDeclarationStatement: members.Add(classBinder.Bind((VariableDeclarationStatementSyntax) memberSyntax, x => classBinder.BindVariableDeclarationStatement(x, classSymbol))); break; case SyntaxKind.FunctionDeclaration: members.Add(classBinder.Bind((FunctionDeclarationSyntax) memberSyntax, x => classBinder.BindFunctionDeclaration(x, classSymbol))); break; case SyntaxKind.FunctionDefinition: members.Add(classBinder.Bind((FunctionDefinitionSyntax) memberSyntax, x => classBinder.BindFunctionDefinition(x, classSymbol))); break; } } foreach (var member in classBinder.LocalSymbols.Values.SelectMany(x => x)) classSymbol.AddMember(member); return new BoundClassType(classSymbol, members.ToImmutableArray()); }
private BoundClassType BindClassDeclaration(ClassTypeSyntax declaration, Symbol parent) { ClassOrStructSymbol baseType; List <InterfaceSymbol> baseInterfaces; BindBaseList(declaration.BaseList, parent, out baseType, out baseInterfaces); var classBinder = new Binder(_sharedBinderState, this); var classSymbol = new ClassSymbol(declaration, parent, baseType, baseInterfaces.ToImmutableArray(), classBinder); AddSymbol(classSymbol, declaration.Name.SourceRange); var members = new List <BoundNode>(); foreach (var memberSyntax in declaration.Members) { switch (memberSyntax.Kind) { case SyntaxKind.VariableDeclarationStatement: members.Add(classBinder.Bind((VariableDeclarationStatementSyntax)memberSyntax, x => classBinder.BindField(x, classSymbol))); break; case SyntaxKind.FunctionDeclaration: members.Add(classBinder.Bind((FunctionDeclarationSyntax)memberSyntax, x => classBinder.BindFunctionDeclaration(x, classSymbol))); break; case SyntaxKind.FunctionDefinition: members.Add(classBinder.Bind((FunctionDefinitionSyntax)memberSyntax, x => classBinder.BindFunctionDefinition(x, classSymbol))); break; } } foreach (var member in classBinder.LocalSymbols.Values.SelectMany(x => x)) { classSymbol.AddMember(member); } return(new BoundClassType(classSymbol, members.ToImmutableArray())); }