protected override BoundNode RewriteNullableBoundNodesWithSnapshots( BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager, ref ImmutableDictionary <Symbol, Symbol> remappedSymbols) { return(NullableWalker.AnalyzeAndRewrite(Compilation, symbol: null, boundRoot, binder, initialState: null, diagnostics, createSnapshots, out snapshotManager, ref remappedSymbols)); }
protected override BoundNode RewriteNullableBoundNodesWithSnapshots( BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager, ref ImmutableDictionary <Symbol, Symbol> remappedSymbols) { Debug.Assert(boundRoot.Syntax is TypeSyntax); return(NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, initialState: null, diagnostics, createSnapshots: false, out snapshotManager, ref remappedSymbols)); }
protected override BoundNode RewriteNullableBoundNodesWithSnapshots( BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager, ref ImmutableDictionary <Symbol, Symbol> remappedSymbols) { // https://github.com/dotnet/roslyn/issues/46424 // Bind and analyze preceding field initializers in order to give an accurate initial nullable state. return(NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol, boundRoot, binder, initialState: null, diagnostics, createSnapshots, out snapshotManager, ref remappedSymbols)); }
private MethodBodySemanticModel( Symbol owner, Binder rootBinder, CSharpSyntaxNode syntax, SyntaxTreeSemanticModel containingSemanticModelOpt = null, SyntaxTreeSemanticModel parentSemanticModelOpt = null, NullableWalker.SnapshotManager snapshotManagerOpt = null, int speculatedPosition = 0) : base(syntax, owner, rootBinder, containingSemanticModelOpt, parentSemanticModelOpt, snapshotManagerOpt, speculatedPosition) { Debug.Assert((object)owner != null); Debug.Assert(owner.Kind == SymbolKind.Method); Debug.Assert(syntax != null); Debug.Assert(syntax.Kind() != SyntaxKind.CompilationUnit); }
public SpeculativeMemberSemanticModel( SyntaxTreeSemanticModel parentSemanticModel, Symbol owner, TypeSyntax root, Binder rootBinder, NullableWalker.SnapshotManager snapshotManagerOpt, ImmutableDictionary <Symbol, Symbol> parentRemappedSymbolsOpt, int position ) : base( root, owner, rootBinder, containingSemanticModelOpt: null, parentSemanticModelOpt: parentSemanticModel, snapshotManagerOpt, parentRemappedSymbolsOpt, speculatedPosition: position ) { Debug.Assert(parentSemanticModel is not null); }
protected override BoundNode RewriteNullableBoundNodesWithSnapshots(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager) { Debug.Assert(boundRoot.Syntax is TypeSyntax); return(NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots: false, out snapshotManager)); }
/// <summary> /// Creates a speculative SemanticModel for a TypeSyntax node at a position within an existing MemberSemanticModel. /// </summary> public SpeculativeMemberSemanticModel(SyntaxTreeSemanticModel parentSemanticModel, Symbol owner, TypeSyntax root, Binder rootBinder, NullableWalker.SnapshotManager snapshotManagerOpt, int position) : base(root, owner, rootBinder, containingSemanticModelOpt: null, parentSemanticModelOpt: parentSemanticModel, snapshotManagerOpt, speculatedPosition: position) { }
protected override BoundNode RewriteNullableBoundNodesWithSnapshots(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager) { return(NullableWalker.AnalyzeAndRewrite(Compilation, symbol: null, boundRoot, binder, diagnostics, createSnapshots, out snapshotManager)); }
/// <summary> /// Creates a speculative SemanticModel for a method body that did not appear in the original source code. /// </summary> internal static MethodBodySemanticModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, StatementSyntax syntax, Binder rootBinder, NullableWalker.SnapshotManager snapshotManagerOpt, int position) { Debug.Assert(parentSemanticModel != null); Debug.Assert(syntax != null); Debug.Assert(rootBinder != null); Debug.Assert(rootBinder.IsSemanticModelBinder); return(new MethodBodySemanticModel(owner, rootBinder, syntax, parentSemanticModelOpt: parentSemanticModel, snapshotManagerOpt: snapshotManagerOpt, speculatedPosition: position)); }
/// <summary> /// Creates a SemanticModel for the method. /// </summary> internal static MethodBodySemanticModel Create(SyntaxTreeSemanticModel containingSemanticModel, MethodSymbol owner, ExecutableCodeBinder executableCodeBinder, CSharpSyntaxNode syntax, BoundNode boundNode = null, NullableWalker.SnapshotManager snapshotManager = null) { Debug.Assert(containingSemanticModel != null); var result = new MethodBodySemanticModel(owner, executableCodeBinder, syntax, containingSemanticModel); if (boundNode != null) { result.UnguardedAddBoundTreeForStandaloneSyntax(syntax, boundNode, snapshotManager); } return(result); }
protected override BoundNode RewriteNullableBoundNodesWithSnapshots(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, out NullableWalker.SnapshotManager snapshotManager) { // https://github.com/dotnet/roslyn/issues/35037: Speculative models are going to have to do something more advanced // here. They will need to run nullable analysis up to the point that is being speculated on, and // then take that state and run analysis on the statement or expression being speculated on. // Currently, it will return incorrect info because it's just running analysis on the speculated // part. return(NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots: false, out snapshotManager)); }