in src/langs/swift/combinator.js [446:490]
resolveCallPath(paths, params, grammer) {
// path type: parent | object | object_static | call | call_static | prop | prop_static | map | list
if (!paths || !paths.length) {
return '';
}
let SEPARATOR = '';
let res = [];
let resolver = {
parent: () => res = ['self'],
class: () => res = [`${this.config.client.name || 'Client'}`],
object: (p) => res.push(`.${this.resolveName(p.name)}${p.needCast ? SEPARATOR : ''}`),
object_static: (p) => res.push(`.${this.resolveName(p.name)}`),
call: (p) => res.push(`.${p.name}(${params})`),
call_static: (p) => res.push(`.${this.resolveName(p.name)}(${params})`),
prop: (p) => res.push(`.${this.resolveName(p.name)}${p.needCast ? SEPARATOR : ''}`),
prop_static: (p) => res.push(`.${this.resolveName(p.name)}`),
map: (p) => {
if (is.grammer(p.name)) {
res.push(`[${this.gramRender(p.name)}]`);
} else {
res.push(`["${p.name}"]`);
}
},
list: (p) => {
if (is.grammer(p.name)) {
res.push(`[${this.gramRender(p.name)}]`);
} else {
res.push(`[${p.name}]`);
}
}
};
for (const p of paths) {
if (resolver[p.type]) {
resolver[p.type].call(this, p);
} else {
debug.stack('Unsupported call path type', p);
}
SEPARATOR = '!';
}
let str = res.join('');
if (str[0] && str[0] === '.') {
str = str.substr(1);
}
return str;
}