resolveParams()

in src/langs/cpp/combinator.js [1141:1201]


  resolveParams(gram) {
    let tmp = [];
    gram.params.forEach(p => {
      let emit = new Emitter(this.config);
      let isUnsetMethod = this.isUnsetMethod(gram);
      if (p.value instanceof BehaviorToMap && gram.type === 'sys_func' && isUnsetMethod) {
        let isPointer = this.isPointerVar(p, true);
        if (!isPointer) {
          emit.emit(this.emitMakeShared(p.dataType, p.value.grammer));
        } else {
          this.grammer(emit, p.value.grammer, false, false);
        }
        tmp.push(emit.output);
      } else if (p.value instanceof BehaviorToMap && gram.type === 'sys_func') {
        tmp.push(this.emitMakeShared('map<string, boost::any>', p));
      } else if (gram.type === 'sys_func' && isUnsetMethod) {
        this.grammer(emit, p, false, false);
        tmp.push(emit.output);
      } else if (gram.type === 'sys_func') {
        if (!this.isPointerVar(p)) {
          emit.emit(this.emitMakeShared(p.dataType, p));
        } else {
          this.grammer(emit, p, false, false);
        }
        tmp.push(emit.output);
      } else if (p instanceof GrammerVar && p.type.objectName === '$Exception') {
        this.grammer(emit, p, false, false);
        tmp.push(`${emit.output}`);
      } else if (p instanceof GrammerValue && p.type === 'map' && p.needCast) {
        this.pushInclude('darabonba_core');
        emit.emit(`${this.config.tea.converter.name}::mapPointer(`);
        this.grammerValue(emit, p);
        emit.emit(')');
        tmp.push(emit.output);
      } else if (p.type === 'var' && is.object(p.value.type) && p.value.varType === 'static_class') {
        tmp.push('nullptr');
      } else if (p.type === 'param') {
        if (this.isPtrStatement(p.value)) {
          tmp.push(p.value);
        } else {
          tmp.push(this.emitMakeShared(p.dataType, p.value));
        }
      } else if (!this.isPointerVar(p)) {
        this.grammer(emit, p, false, false);
        let dataType = this.resolveDataType(p);
        if (is.stream(p.dataType)) {
          tmp.push(emit.output);
        } else if (p.type === 'behavior' && p.value instanceof BehaviorToMap) {
          tmp.push(this.emitMakeShared('map<string, boost::any>', emit.output));
        } else if (!this.isPointerVar(p)) {
          tmp.push(this.emitMakeShared(dataType, emit.output));
        } else {
          tmp.push(emit.output);
        }
      } else {
        this.grammerValue(emit, p);
        tmp.push(emit.output);
      }
    });
    return tmp.join(', ');
  }