public override IEnumerable <SyntaxNodeSymbolSemanticModelTuple> GetRemovableFieldLikeDeclarations(ISet <SyntaxKind> kinds, Accessibility maxAccessibility) { var fieldLikeNodes = TypeDeclarations .SelectMany(typeDeclaration => SelectMatchingDeclarations(typeDeclaration, kinds) .Select(node => new SyntaxNodeAndSemanticModel <BaseFieldDeclarationSyntax> { SyntaxNode = (BaseFieldDeclarationSyntax)node, SemanticModel = typeDeclaration.SemanticModel })); return(fieldLikeNodes .SelectMany(fieldLikeNode => fieldLikeNode.SyntaxNode.Declaration.Variables .Select(variable => SelectNodeTuple(variable, fieldLikeNode.SemanticModel)) .Where(tuple => IsRemovable(tuple.Symbol, maxAccessibility)))); }
protected internal override void CheckSemantics(AstHelper astHelper) { AstHelper helper = astHelper.CreateChild(function: true, variables: true, types: true); // add all type builders to the scope in case of recursive type calls foreach (IAddToScope typeDeclarationNode in TypeDeclarations.OfType <IAddToScope>()) { typeDeclarationNode.AddToScope(helper); } var error = new CircularTypeReferencesError(TypeDeclarations, Start); astHelper.Errors.Check(error); // define other types foreach (TypeDeclarationNode typeDeclarationNode in error.OrderedTypes) { typeDeclarationNode.CheckSemantics(helper); } // add all functions to the scope in case of recursive calls foreach (FunctionDefinitionExpression functionDefinitionExpression in FunctionDefinitions) { functionDefinitionExpression.AddToScope(helper); } foreach (VariableDeclarationBase variableDeclarationExpression in VariableDeclarations) { variableDeclarationExpression.CheckSemantics(helper); } foreach (FunctionDefinitionExpression functionDefinitionExpression in FunctionDefinitions) { functionDefinitionExpression.CheckSemantics(helper); } Body.CheckSemantics(helper); IEnumerable <ParameterExpression> variables = from variable in VariableDeclarations select variable.Pointer; IEnumerable <ParameterExpression> functions = from function in FunctionDefinitions select function.Pointer; // calculate the closure that will be used when we're generating the expression _closure = variables.Union(functions); }
public void AddType(TypeDeclarationNode type) { TypeDeclarations.Add(type); }