internal int CopyTo(int offset, char[] destination, int destinationOffset, int length, IPrimarySourceLocation primarySourceLocation) { if (this.offset <= offset && offset < this.offset + this.buffer.Length && offset+length <= this.offset+this.buffer.Length) { Array.Copy(this.buffer, offset-this.offset, destination, destinationOffset, length); return length; } else return primarySourceLocation.CopyTo(offset-primarySourceLocation.StartIndex, destination, destinationOffset, length); }
internal SourceLocationWrapper( IPrimarySourceLocation firstSourceLocation, IPrimarySourceLocation lastSourceLocation, Func<string> getSource) { this.firstSourceLocation = firstSourceLocation; this.lastSourceLocation = lastSourceLocation; this.source = new Lazy<string>(getSource); }
private static SourceCodeLocation Of(this IObjectWithLocations locatable, PdbReader pdb) { IPrimarySourceLocation location = locatable.GetValidLocation(pdb); return(location != null?location.ToSourceCodeLocation() : SourceCodeLocation.None); }
private ISourceMappedItem GetSourceMappedItem(IPrimarySourceLocation location, MissingInfo memberInfo) { var unsupportedPlatformNames = GetUnsupportedPlatformNames(GetTargetStatus(memberInfo)); return new CciSourceItem(location, memberInfo, unsupportedPlatformNames); }
private PointerIsValidationLocation(CompileTimeConstant pointerSize, IPrimarySourceLocation expressionLocation) : base(expressionLocation) { this.pointerSize = pointerSize; }
static void GetLocationLineSpan(IPrimarySourceLocation loc, out uint startLine, out uint endLine) { IIncludedSourceLocation/*?*/ iloc = loc as IIncludedSourceLocation; if (iloc != null) { startLine = (uint)iloc.OriginalStartLine; endLine = (uint)iloc.OriginalEndLine; } else { startLine = (uint)loc.StartLine; endLine = (uint)loc.EndLine; } }
public void HandleErrors(object sender, Microsoft.Cci.ErrorEventArgs args) { foreach (IErrorMessage error in args.Errors) { ISourceLocation /*?*/ sourceLocation = error.Location as ISourceLocation; if (sourceLocation == null) { continue; } if (this.DebugOnWarningOrError) { System.Diagnostics.Debugger.Launch(); } bool isError = !error.IsWarning || WarningsAsErrors; if (!isError && GetWarningLevel(error.Code) > WarningLevel) { continue; } if (isError) { VccCommandLineHost.IncreaseErrorCount(); } CompositeSourceDocument /*?*/ compositeDocument = sourceLocation.SourceDocument as CompositeSourceDocument; if (compositeDocument != null) { foreach (ISourceLocation sl in compositeDocument.GetFragmentLocationsFor(sourceLocation)) { sourceLocation = sl; break; } } IPrimarySourceLocation /*?*/ primarySourceLocation = sourceLocation as IPrimarySourceLocation; if (primarySourceLocation == null) { Logger.Instance.Error(error.Message); continue; } string docName = primarySourceLocation.SourceDocument.Location ?? primarySourceLocation.SourceDocument.Name.Value; int startLine = primarySourceLocation.StartLine; int startColumn = primarySourceLocation.StartColumn; IncludedSourceLocation /*?*/ includedSourceLocation = primarySourceLocation as IncludedSourceLocation; if (includedSourceLocation != null) { docName = includedSourceLocation.OriginalSourceDocumentName; if (docName != null) { docName = docName.Replace("\\\\", "\\"); } startLine = includedSourceLocation.OriginalStartLine; } long id = error.IsWarning ? ErrorToId(error.Code) : error.Code; if (WarningIsDisabled(id)) { return; } Logger.Instance.LogWithLocation(String.Format("VC{0:0000}", id), error.Message, new Location(docName, startLine, startColumn), isError ? LogKind.Error : LogKind.Warning, false); string firstErrFile = docName; int firstErrLine = startLine; foreach (ILocation relatedLocation in error.RelatedLocations) { ISourceLocation /*?*/ sloc = relatedLocation as ISourceLocation; if (sloc != null) { compositeDocument = sloc.SourceDocument as CompositeSourceDocument; if (compositeDocument != null) { foreach (ISourceLocation sl in compositeDocument.GetFragmentLocationsFor(sloc)) { sloc = sl; break; } } primarySourceLocation = sloc as IPrimarySourceLocation; if (primarySourceLocation == null) { continue; } docName = primarySourceLocation.SourceDocument.Location ?? primarySourceLocation.SourceDocument.Name.Value; startLine = primarySourceLocation.StartLine; startColumn = primarySourceLocation.StartColumn; includedSourceLocation = primarySourceLocation as IncludedSourceLocation; if (includedSourceLocation != null) { docName = includedSourceLocation.OriginalSourceDocumentName; if (docName != null) { docName = docName.Replace("\\\\", "\\"); } startLine = includedSourceLocation.OriginalStartLine; } if (docName != firstErrFile || firstErrLine != startLine) { Logger.Instance.LogWithLocation( null, String.Format("(Location of symbol related to previous {0}.)", isError ? "error" : "warning"), new Location(docName, startLine, startColumn), isError ? LogKind.Error : LogKind.Warning, true); } } //TODO: deal with non source locations } } }
void ICcsHost.Event(CcsEventLevel level, IPrimarySourceLocation location, string format, params object[] args) { Contract.Requires(location != null); Contract.Requires(!String.IsNullOrEmpty(format)); Contract.Requires(args != null); throw new NotImplementedException(); }
internal ExpressionSourceLocation(IPrimarySourceLocation primarySourceLocation) { Contract.Requires(primarySourceLocation != null); this.primarySourceLocation = primarySourceLocation; }
public CciMethodLine(IPrimarySourceLocation sourceLocation) { SourceLocation = sourceLocation; }
public void Event(CcsEventLevel level, IPrimarySourceLocation location, string format, params object[] args) { //Contract.Requires(location != null); //Contract.Requires(!String.IsNullOrEmpty(format)); this.Event(level, location, String.Format(format, args)); }
public void Event(CcsEventLevel level, IPrimarySourceLocation location, string message) { this.CountErrorsAndWarnings(level); [email protected]("CciSharp: {0}({1}): {2}{3}", location.SourceDocument.Location, location.StartLine, LevelToString(level), message); }
public CciSourceItem(IPrimarySourceLocation location, MissingInfo item, IEnumerable<FrameworkName> unsupportedPlatformNames) { _column = location.StartColumn; _line = location.StartLine; _path = location.SourceDocument.Location; _item = item; _unsupportedPlatforms = unsupportedPlatformNames; }
private void PrintSourceLocation(IPrimarySourceLocation psloc) { sourceEmitterOutput.WriteLine(""); sourceEmitterOutput.Write(psloc.Document.Name.Value + "(" + psloc.StartLine + ":" + psloc.StartColumn + ")-(" + psloc.EndLine + ":" + psloc.EndColumn + "): ", true); sourceEmitterOutput.WriteLine(psloc.Source); }
void ICcsHost.Event(CcsEventLevel level, IPrimarySourceLocation location, string message) { Contract.Requires(location != null); Contract.Requires(!String.IsNullOrEmpty(message)); throw new NotImplementedException(); }
protected AssertionAdderSourceLocationWrapper(IPrimarySourceLocation wrappedSourceLocation) { this.wrappedSourceLocation = wrappedSourceLocation; }
internal PreprocessorSourceLocation(IPrimarySourceLocation slFromDocument, Preprocessor preprocessor) { this.slFromDocument = slFromDocument; this.preprocessor = preprocessor; }
internal static PointerIsValidationLocation For(CompileTimeConstant pointerSize, IEnumerable <ILocation> locations) { IPrimarySourceLocation ploc = AssertAssumeAdderVisitor.GetPrimarySourceLocationFrom(locations); return(new PointerIsValidationLocation(pointerSize, ploc)); }
internal string GetSource(IPrimarySourceLocation primarySourceLocation) { if (this.offset <= primarySourceLocation.StartIndex && primarySourceLocation.EndIndex <= this.offset+this.buffer.Length) return new String(this.buffer, primarySourceLocation.StartIndex-this.offset, primarySourceLocation.Length); else return primarySourceLocation.Source; }
private ISourceMappedItem GetSourceMappedItem(IPrimarySourceLocation location, MissingInfo memberInfo) { var unsupportedPlatformNames = GetUnsupportedPlatformNames(GetTargetStatus(memberInfo)); return(new CciSourceItem(_assemblyPath, location, memberInfo, unsupportedPlatformNames)); }
private void PrintSourceLocation(IPrimarySourceLocation psloc) { sourceEmitterOutput.WriteLine(""); sourceEmitterOutput.Write(psloc.Document.Name.Value+"("+psloc.StartLine+":"+psloc.StartColumn+")-("+psloc.EndLine+":"+psloc.EndColumn+"): "); var source = psloc.Source; var newLinePos = source.IndexOf('\n'); if (newLinePos > 0) source = source.Substring(0, newLinePos); sourceEmitterOutput.WriteLine(source); }
internal void HandleErrors(object sender, Microsoft.Cci.ErrorEventArgs args) { foreach (IErrorMessage error in args.Errors) { ISourceLocation /*?*/ sourceLocation = error.Location as ISourceLocation; if (sourceLocation == null) { continue; } if (!error.IsWarning) { hasError = true; } CompositeSourceDocument /*?*/ compositeDocument = sourceLocation.SourceDocument as CompositeSourceDocument; if (compositeDocument != null) { foreach (ISourceLocation sl in compositeDocument.GetFragmentLocationsFor(sourceLocation)) { sourceLocation = sl; break; } } IPrimarySourceLocation /*?*/ primarySourceLocation = sourceLocation as IPrimarySourceLocation; if (primarySourceLocation == null) { Console.Out.WriteLine(error.Message); continue; } string docName = primarySourceLocation.SourceDocument.Name.Value; int startLine = primarySourceLocation.StartLine; int startColumn = primarySourceLocation.StartColumn; int endLine = primarySourceLocation.EndLine; int endColumn = primarySourceLocation.EndColumn; IncludedSourceLocation /*?*/ includedSourceLocation = primarySourceLocation as IncludedSourceLocation; if (includedSourceLocation != null) { docName = includedSourceLocation.OriginalSourceDocumentName; startLine = includedSourceLocation.OriginalStartLine; endLine = includedSourceLocation.OriginalEndLine; } if (!displayFileName) { docName = ""; } Console.Out.WriteLine("{6}({0},{1})-({2},{3}): {4}: {5}", startLine, startColumn, endLine, endColumn, error.IsWarning ? "warning" : "error", error.Message, docName); foreach (ILocation relatedLocation in error.RelatedLocations) { ISourceLocation /*?*/ sloc = relatedLocation as ISourceLocation; if (sloc != null) { compositeDocument = sloc.SourceDocument as CompositeSourceDocument; if (compositeDocument != null) { foreach (ISourceLocation sl in compositeDocument.GetFragmentLocationsFor(sloc)) { sloc = sl; break; } } primarySourceLocation = sloc as IPrimarySourceLocation; if (primarySourceLocation == null) { continue; } docName = primarySourceLocation.SourceDocument.Name.Value; startLine = primarySourceLocation.StartLine; startColumn = primarySourceLocation.StartColumn; endLine = primarySourceLocation.EndLine; endColumn = primarySourceLocation.EndColumn; includedSourceLocation = primarySourceLocation as IncludedSourceLocation; if (includedSourceLocation != null) { docName = includedSourceLocation.OriginalSourceDocumentName; startLine = includedSourceLocation.OriginalStartLine; endLine = includedSourceLocation.OriginalEndLine; } Console.Out.WriteLine("({0},{1})-({2},{3}): (Location of symbol related to previous {4}.)", startLine, startColumn, endLine, endColumn, error.IsWarning ? "warning" : "error"); } //TODO: deal with non source locations } } }