forked from apiaryio/drafter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConversionContext.cc
39 lines (32 loc) · 1.03 KB
/
ConversionContext.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// ConversionContext.cc
// drafter
//
// Created by Pavan Kumar Sunkara on 18/08/16.
// Copyright © 2016 Apiary. All rights reserved.
//
#include "ConversionContext.h"
namespace drafter
{
void ConversionContext::warn(const snowcrash::Warning& warning)
{
for (auto& item : warnings) {
bool equalSourceMap = true;
// Compare sourcemap
if (item.location.size() == warning.location.size()) {
for (size_t i = 0; i < item.location.size(); i++) {
if (item.location.at(i).length != warning.location.at(i).length
|| item.location.at(i).location != warning.location.at(i).location) {
equalSourceMap = false;
}
}
} else {
equalSourceMap = false;
}
if (equalSourceMap && item.code == warning.code && item.message == warning.message) {
return;
}
}
warnings.push_back(warning);
}
}