parseCommon: parse hints before locations

This commit is contained in:
Jannis R 2020-02-15 19:09:05 +00:00
parent 8fd72ca6f5
commit d98910a651
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -49,6 +49,19 @@ const parseCommonData = (_ctx) => {
// **.arr.aProdX: arrivalLine -> common.lines[idx]
}
common.hints = []
if (Array.isArray(c.remL)) {
common.hints = c.remL.map(hint => profile.parseHint(ctx, hint))
matches['**.remX'].forEach(([idx, parents]) => {
if ('number' === typeof idx) parents[0].hint = common.hints[idx]
})
matches['**.rRefL'].forEach(([idxs, parents]) => {
parents[0].hints = idxs
.filter(idx => !!common.hints[idx])
.map(idx => common.hints[idx])
})
}
common.locations = []
if (Array.isArray(c.locL)) {
common.locations = c.locL.map(loc => profile.parseLocation(ctx, loc))
@ -80,18 +93,6 @@ const parseCommonData = (_ctx) => {
})
}
common.hints = []
if (Array.isArray(c.remL)) {
common.hints = c.remL.map(hint => profile.parseHint(ctx, hint))
matches['**.remX'].forEach(([idx, parents]) => {
if ('number' === typeof idx) parents[0].hint = common.hints[idx]
})
matches['**.rRefL'].forEach(([idxs, parents]) => {
parents[0].hints = idxs
.filter(idx => !!common.hints[idx])
.map(idx => common.hints[idx])
})
}
common.warnings = []
if (Array.isArray(c.himL)) {
common.warnings = c.himL.map(w => profile.parseWarning(ctx, w))