поля jsdoc не проанализированы - PullRequest
0 голосов
/ 23 мая 2018

Почему мои поля игнорируются jsdoc?

/**
* Matrix object for operations on matrices
* @constructor
* @param {number[][]} m - values
* @param {number} def - default size def x def
*/
function Matrix(m, def){

/**
number[][] - values
*/
this.m;

/** 
 * number - number of rows 
 */
this.rows;

/**
 * number - number of cols
 */
this.cols;



if(m != null){
    this.m = m;
    this.rows = m[0].length;
    this.cols = m.length;
}
else {
    this.m = new Array(def);
    for (var i = 0; i < def; i++) {
        this.m[i] = new Array(def);
    }
    this.rows = def;
    this.cols = def;
    this.initI();
}
}

/**
 * initializes the Matrix as Ident-Matrix
 */
Matrix.prototype.initI = function(){
    for(var i = 0; i < this.rows; i++){
       for(var j = 0; j < this.cols; j++) {
            if(i == j) this.m[i][j] = 1;
            else this.m[i][j] = 0;
       }
   }
}

Объект с его функцией обычно анализируется, однако jsdoc игнорирует поля m, rows и cols.

В другом коде, где я не использую синтаксис prototype, он обычно разбирается.отредактировал цифры

1 Ответ

0 голосов
/ 23 мая 2018

Я только что увидел, что вы должны присвоить значение полю, чтобы jsdoc проанализировал его

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...