mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix: qualifier matcher did not support multiple qualifiers for a single file. (#9720)
This commit is contained in:

committed by
Nathan Walker

parent
5c7c3529f4
commit
3d03f8f06a
@ -119,20 +119,21 @@ const supportedQualifiers: Array<QualifierSpec> = [minWidthHeightQualifier, minW
|
|||||||
|
|
||||||
function checkQualifiers(path: string, context: PlatformContext): number {
|
function checkQualifiers(path: string, context: PlatformContext): number {
|
||||||
let result = 0;
|
let result = 0;
|
||||||
|
let value: number;
|
||||||
for (let i = 0; i < supportedQualifiers.length; i++) {
|
for (let i = 0; i < supportedQualifiers.length; i++) {
|
||||||
const qualifier = supportedQualifiers[i];
|
const qualifier = supportedQualifiers[i];
|
||||||
if (qualifier.isMatch(path)) {
|
if (qualifier.isMatch(path)) {
|
||||||
const occurences = qualifier.getMatchOccurences(path);
|
const occurences = qualifier.getMatchOccurences(path);
|
||||||
// Always get the last qualifier among identical occurences
|
// Always get the last qualifier among identical occurences
|
||||||
result = qualifier.getMatchValue(occurences[occurences.length - 1], context);
|
value = qualifier.getMatchValue(occurences[occurences.length - 1], context);
|
||||||
if (result < 0) {
|
if (value < 0) {
|
||||||
// Non of the supported qualifiers matched this or the match was not satisfied
|
// Non of the supported qualifiers matched this or the match was not satisfied
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result += (supportedQualifiers.length - i) * PRIORITY_STEP;
|
if (value > 0) {
|
||||||
|
result += value + (supportedQualifiers.length - i) * PRIORITY_STEP;
|
||||||
return result;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user