public VariableFlags(IExecutableDeclaration declaration, ISymbolTree symbolTree, bool defaultValue) { var invocableSymbol = declaration.Symbol; symbolMap = symbolTree.Children(invocableSymbol).Cast <BindingSymbol>().Enumerate().ToFixedDictionary(); flags = new BitArray(symbolMap.Count, defaultValue); }
private DeclarationIL?BuildDefaultConstructor( IClassDeclaration classDeclaration, ISymbolTree symbolTree) { var constructorSymbol = classDeclaration.DefaultConstructorSymbol; if (constructorSymbol is null) { return(null); } if (declarationsIL.TryGetValue(constructorSymbol, out var declaration)) { return(declaration); } var selfParameterSymbol = symbolTree.Children(constructorSymbol).OfType <SelfParameterSymbol>().Single(); var selfParameter = new SelfParameterIL(selfParameterSymbol); var parameters = selfParameter.Yield().ToFixedList <ParameterIL>(); var graph = new ControlFlowGraphBuilder(classDeclaration.File); graph.AddSelfParameter(selfParameterSymbol); var block = graph.NewBlock(); block.End(new ReturnVoidInstruction(classDeclaration.NameSpan, Scope.Outer)); //var il = new ControlFlowGraphBuilder(classDeclaration.File); //il.AddSelfParameter(selfType); //var block = il.NewBlock(); //block.End(classDeclaration.NameSpan, Scope.Outer); var defaultConstructor = new ConstructorIL(// TODO how to get a name constructorSymbol, parameters, FixedList <FieldInitializationIL> .Empty, graph.Build()); //defaultConstructor.ControlFlowOld.InsertedDeletes = new InsertedDeletes(); declarationsIL.Add(constructorSymbol, defaultConstructor); return(defaultConstructor); }