visitAssign()

in lib/generator.js [2019:2045]


  visitAssign(ast, level) {
    if (ast.left.type === 'property_assign' || ast.left.type === 'property') {
      this.emit('', level);
      this.visitPropertyAccess(ast.left);
    } else if (ast.left.type === 'virtualVariable') { // vid
      this.emit(`$this->${_vid(ast.left.vid)}`, level);
    } else if (ast.left.type === 'variable') {
      this.emit(`$${_name(ast.left.id)}`, level);
    } else if (ast.left.type === 'map_access') {
      this.visitMapAccess(ast.left, level);
    } else if (ast.left.type === 'array_access') {
      this.visitArrayAccess(ast.left, level);
    } else {
      throw new Error('unimpelemented');
    }

    this.emit(' = ');
    // if (ast.expr.needToReadable) {
    //   const streamName = this.getRealModelName(STREAM);
    //   this.emit(`new ${streamName}(`);
    // }
    this.visitExpr(ast.expr, level);
    // if (ast.expr.needToReadable) {
    //   this.emit(')');
    // }
    this.emit(';\n');
  }