UNPKG

1.53 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Label = void 0;
4const propertyInstruction_1 = require("../propertyInstruction");
5const util_1 = require("../util");
6class Label extends propertyInstruction_1.PropertyInstruction {
7 constructor(document, range, dockerfile, escapeChar, instruction, instructionRange) {
8 super(document, range, dockerfile, escapeChar, instruction, instructionRange);
9 }
10 getVariables() {
11 const variables = super.getVariables();
12 const properties = this.getProperties();
13 // iterate over all of this LABEL's properties
14 for (const property of properties) {
15 const value = property.getUnescapedValue();
16 // check if the value is contained in single quotes,
17 // single quotes would indicate a literal value
18 if (value !== null && value.length > 2 && value.charAt(0) === '\'' && value.charAt(value.length - 1) === '\'') {
19 const range = property.getValueRange();
20 for (let i = 0; i < variables.length; i++) {
21 // if a variable is in a single quote, remove it from the list
22 if (util_1.Util.isInsideRange(variables[i].getRange().start, range)) {
23 variables.splice(i, 1);
24 i--;
25 }
26 }
27 }
28 }
29 return variables;
30 }
31 getProperties() {
32 return super.getProperties();
33 }
34}
35exports.Label = Label;