public void GeneratedCodeMappingsAreNotEqualIfStartLineIsNotEqual()
 {
     GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
     GeneratedCodeMapping right = new GeneratedCodeMapping(21, 34, 56, 87);
     Assert.False(left == right);
     Assert.False(left.Equals(right));
     Assert.False(right.Equals(left));
     Assert.False(Equals(left, right));
 }
 public void GeneratedCodeMappingsAreEqualIfDataIsEqual()
 {
     GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 78);
     GeneratedCodeMapping right = new GeneratedCodeMapping(12, 34, 56, 78);
     Assert.True(left == right);
     Assert.True(left.Equals(right));
     Assert.True(right.Equals(left));
     Assert.True(Equals(left, right));
 }
Example #3
0
        private void AddCodeMapping(int pragmaId, SourceLocation sourceLocation, int generatedCodeStart, int generatedCodeLength)
        {
            GeneratedCodeMapping mapping = new GeneratedCodeMapping(
                startLine: sourceLocation.LineIndex + 1,
                startColumn: sourceLocation.CharacterIndex + 1,
                startGeneratedColumn: generatedCodeStart + 1,
                codeLength: generatedCodeLength);

            CodeMappings[pragmaId] = mapping;
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (!(obj is GeneratedCodeMapping))
            {
                return(false);
            }
            GeneratedCodeMapping other = (GeneratedCodeMapping)obj;

            return(CodeLength == other.CodeLength &&
                   StartColumn == other.StartColumn &&
                   StartGeneratedColumn == other.StartGeneratedColumn &&
                   StartLine == other.StartColumn);
        }
Example #5
0
        public override bool Equals(object obj)
        {
            if (!(obj is GeneratedCodeMapping))
            {
                return(false);
            }
            GeneratedCodeMapping other = (GeneratedCodeMapping)obj;

            return(CodeLength == other.CodeLength &&
                   StartColumn == other.StartColumn &&
                   StartGeneratedColumn == other.StartGeneratedColumn &&
                   StartLine == other.StartLine &&
                   // Null means it matches the other no matter what.
                   (StartOffset == null || other.StartOffset == null || StartOffset.Equals(other.StartOffset)));
        }
Example #6
0
        public int AddCodeMapping(SourceLocation sourceLocation, int generatedCodeStart, int generatedCodeLength)
        {
            if (generatedCodeStart == Int32.MaxValue)
            {
                throw new ArgumentOutOfRangeException("generatedCodeStart");
            }

            GeneratedCodeMapping mapping = new GeneratedCodeMapping(
                startOffset: sourceLocation.AbsoluteIndex,
                startLine: sourceLocation.LineIndex + 1,
                startColumn: sourceLocation.CharacterIndex + 1,
                startGeneratedColumn: generatedCodeStart + 1,
                codeLength: generatedCodeLength);

            int id = _nextDesignTimePragmaId++;

            CodeMappings[id] = mapping;
            return(id);
        }
        public int AddCodeMapping(SourceLocation sourceLocation, int generatedCodeStart, int generatedCodeLength)
        {
            if (generatedCodeStart == Int32.MaxValue)
            {
                throw new ArgumentOutOfRangeException("generatedCodeStart");
            }

            GeneratedCodeMapping mapping = new GeneratedCodeMapping(
                startOffset: sourceLocation.AbsoluteIndex,
                startLine: sourceLocation.LineIndex + 1,
                startColumn: sourceLocation.CharacterIndex + 1,
                startGeneratedColumn: generatedCodeStart + 1,
                codeLength: generatedCodeLength);

            int id = _nextDesignTimePragmaId++;
            CodeMappings[id] = mapping;
            return id;
        }