public Declaration(SourceUnit /*!*/ sourceUnit, IDeclaree /*!*/ declaree, bool isPartial, bool isConditional, Scope scope, Position position) { this.sourceUnit = sourceUnit; this.declaree = declaree; this.scope = scope; this.position = position; this.isPartial = isPartial; this.isConditional = isConditional; }
public Declaration(CompilationSourceUnit /*!*/ sourceUnit, IDeclaree /*!*/ declaree, bool isPartial, bool isConditional, Scope scope, Text.Span position) { this.sourceUnit = sourceUnit; this.declaree = declaree; this.scope = scope; this.span = position; this.isPartial = isPartial; this.isConditional = isConditional; }
public Declaration GetExactVersion(Declaration /*!*/ declaration) { IDeclaree declaree = this.declaree; do { if (ReferenceEquals(declaree, declaration.Declaree)) { return(declaree.Declaration); } declaree = declaree.Version.Next; }while (declaree != null); return(null); }
private void AddDeclaration(ErrorSink /*!*/ errors, IDeclaree /*!*/ member, Dictionary <QualifiedName, Declaration> /*!*/ table) { Declaration existing; Declaration current = member.Declaration; if (table.TryGetValue(member.QualifiedName, out existing)) { // partial declarations are not allowed in transient code => nothing to check; if (CheckDeclaration(errors, member, existing)) { AddVersionToGroup(current, existing); } } else { // add a new declaration to the table: table.Add(member.QualifiedName, current); } }
protected bool CheckDeclaration(ErrorSink /*!*/ errors, IDeclaree /*!*/ member, Declaration /*!*/ existing) { Declaration current = member.Declaration; if (existing.IsPartial ^ current.IsPartial) { TryFixPartial(errors, current, existing); TryFixPartial(errors, existing, current); } if ((!existing.IsPartial || !current.IsPartial) && (!existing.IsConditional || !current.IsConditional)) { // report fatal error (do not throw an exception, just don't let the analysis continue): member.ReportRedeclaration(errors); errors.Add(FatalErrors.RelatedLocation, existing.SourceUnit, existing.Span); return(false); } return(true); }
protected bool CheckDeclaration(ErrorSink/*!*/ errors, IDeclaree/*!*/ member, Declaration/*!*/ existing) { Declaration current = member.Declaration; if (existing.IsPartial ^ current.IsPartial) { TryFixPartial(errors, current, existing); TryFixPartial(errors, existing, current); } if ((!existing.IsPartial || !current.IsPartial) && (!existing.IsConditional || !current.IsConditional)) { // report fatal error (do not throw an exception, just don't let the analysis continue): member.ReportRedeclaration(errors); errors.Add(FatalErrors.RelatedLocation, existing.SourceUnit, existing.Position); return false; } return true; }
private void AddDeclaration(ErrorSink/*!*/ errors, IDeclaree/*!*/ member, Dictionary<QualifiedName, Declaration>/*!*/ table) { Declaration existing; Declaration current = member.Declaration; if (table.TryGetValue(member.QualifiedName, out existing)) { // partial declarations are not allowed in transient code => nothing to check; if (CheckDeclaration(errors, member, existing)) AddVersionToGroup(current, existing); } else { // add a new declaration to the table: table.Add(member.QualifiedName, current); } }