Beispiel #1
0
        public LocalVariable(AstVariableDeclaration declaration, bool isFunctionParameter, int stackIndex, SourceMapEntry sourceMapEntry)
        {
            // Set our extended properties
            StackIndex          = stackIndex;
            SourceMapEntry      = sourceMapEntry;
            IsFunctionParameter = isFunctionParameter;

            // Initialize by name and type.
            Initialize(declaration);
        }
Beispiel #2
0
 public bool Contains(SourceMapEntry other)
 {
     return(SourceIndex == other.Index && Offset <= other.Offset && OffsetEnd >= (other.Offset + other.Length));
 }
 public LocalVariable(AstVariableDeclaration declaration, bool isFunctionParameter, int stackIndex, SourceMapEntry sourceMapEntry) : base(declaration)
 {
     // Set our extended properties
     StackIndex          = stackIndex;
     SourceMapEntry      = sourceMapEntry;
     IsFunctionParameter = isFunctionParameter;
 }
Beispiel #4
0
        public static IEnumerable <SourceFileLine> GetSourceFileLinesFromSourceMapEntry(SourceMapEntry entry, IReadOnlyDictionary <int, SourceFileMap> sourceIndexes)
        {
            // This should only ever be missing when the source file is explicitly ignored
            if (!sourceIndexes.TryGetValue(entry.Index, out var sourceFileMap))
            {
                return(null);
            }

            var sourceFileLines = sourceFileMap.SourceFileLines
                                  .Where(s => entry.Offset >= s.Offset && entry.Offset < s.OffsetEnd);

            foreach (var l in sourceFileLines)
            {
                if (l.SourceFileMapParent.SourceFileIndex != entry.Index)
                {
                    throw new Exception($"Source file index mismatch between {l.SourceFileMapParent.SourceFileIndex} and {entry.Index}");
                }
            }

            return(sourceFileLines);
        }