javascript - What does "WARNING - Suspicious code. The result of the 'getprop' operator is not being us

"WARNING - Suspicious code. The result of the 'getprop' operator is not being used."

"WARNING - Suspicious code. The result of the 'getprop' operator is not being used."

I'm seeing this for two lines in my JavaScript code when I use the closure piler. They are typedefs in among other typedefs that don't report issues. What should I be looking for?

EDIT

Affected code:

/**
 * @typedef {{playerId: number, playerName: string, baseScores: Array.<number>, bonusScores: Array.<number>,
 *          teamScoreAdjustments: Array.<number>}}
 */
wias.GameTableTeamMember;

/**
 * @typedef {{id: number, teamMembers: Array<wias.GameTableTeamMember>, teamName: string}}
 */
wias.GameTableTeam;

/**
 * @typedef {{id: number, availableRound: boolean, bonusScoring: boolean, plete: boolean, gameLength: number,
 *          gameType: string, lastPlayed: string, numberOfRounds: number, teams: Array.<wias.GameTableTeam>, winners:
 *          Array.<string>}}
 */
wias.GameTable;

Warning:

wias.js:77: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
wias.GameTableTeam;
^

Why a warning there and not elsewhere?

"WARNING - Suspicious code. The result of the 'getprop' operator is not being used."

I'm seeing this for two lines in my JavaScript code when I use the closure piler. They are typedefs in among other typedefs that don't report issues. What should I be looking for?

EDIT

Affected code:

/**
 * @typedef {{playerId: number, playerName: string, baseScores: Array.<number>, bonusScores: Array.<number>,
 *          teamScoreAdjustments: Array.<number>}}
 */
wias.GameTableTeamMember;

/**
 * @typedef {{id: number, teamMembers: Array<wias.GameTableTeamMember>, teamName: string}}
 */
wias.GameTableTeam;

/**
 * @typedef {{id: number, availableRound: boolean, bonusScoring: boolean, plete: boolean, gameLength: number,
 *          gameType: string, lastPlayed: string, numberOfRounds: number, teams: Array.<wias.GameTableTeam>, winners:
 *          Array.<string>}}
 */
wias.GameTable;

Warning:

wias.js:77: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
wias.GameTableTeam;
^

Why a warning there and not elsewhere?

Share Improve this question edited Feb 3, 2012 at 6:53 Ben Flynn asked Feb 3, 2012 at 6:13 Ben FlynnBen Flynn 18.9k21 gold badges101 silver badges144 bronze badges 1
  • I'm not sure what the warning means, but I'm curious to see the actual code it is talking about... – nnnnnn Commented Feb 3, 2012 at 6:32
Add a ment  | 

1 Answer 1

Reset to default 6

It means that you have code which does nothing.

Typedef's (or record types) are more tricky for the piler to point to the exact spot where the issue is, but somewhere you are getting a value which is not being used.

some reading about the type system and what works best with the piler https://docs.google./document/d/1Uq_vNyPZjlRvYZJclX6N37Fjsiah4XNciEPSBfFiREs/edit

and to recreate the warning simply

if (true) {
   //have nothing in here
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742346833a4426711.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信