protected BoundNode(BoundKind kind, SyntaxNode syntax, bool hasErrors) : this(kind, syntax) { if (hasErrors) { _attributes = BoundNodeAttributes.HasErrors; } }
protected BoundNode(BoundKind kind, CSharpSyntaxNode syntax, bool hasErrors) : this(kind, syntax) { if (hasErrors) { this.attributes = BoundNodeAttributes.HasErrors; } }
// PERF: it is very uncommon for a flag being forcibly reset // so we do not support it in general (making the commonly used implementation simpler) // and instead have a special method to do resetting. public void ResetCompilerGenerated(bool newCompilerGenerated) { #if DEBUG Debug.Assert((_attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0, "compiler generated flag should not be set after reading it"); #endif if (newCompilerGenerated) { _attributes |= BoundNodeAttributes.CompilerGenerated; } else { _attributes &= ~BoundNodeAttributes.CompilerGenerated; } }
protected BoundNode(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors) { Debug.Assert(syntax != null); _kind = kind; _boundTree = boundTree; if (childBoundNodes.All(cbn => cbn is BoundNode)) { _childBoundNodes = childBoundNodes.Cast <BoundNode>().ToImmutableArray(); } else { _childBoundNodes = childBoundNodes; } _syntax = syntax; if (hasErrors) { _attributes |= BoundNodeAttributes.HasErrors; } }
// PERF: it is very uncommon for a flag being forcibly reset // so we do not support it in general (making the commonly used implementation simpler) // and instead have a special method to do resetting. public void ResetCompilerGenerated(bool newCompilerGenerated) { #if DEBUG Debug.Assert((attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0, "compiler generated flag should not be set after reading it"); #endif if (newCompilerGenerated) { attributes |= BoundNodeAttributes.CompilerGenerated; } else { attributes &= ~BoundNodeAttributes.CompilerGenerated; } }