语言

Menu
Sites
Language
Tizen Studio false positive "problems"

I have two javascript files as part of my project in Tizen Studio 2.3, lets say A.js and B.js.  I've defined some functions in B.js that are used by functions in A.js...of couse, my index.html references both A.js and B.js as script sources.  Yet, Tizen Studio says I've got an undefined function in A.js (even though it IS defined in B.js) How do I tell Tizen Studio to look broader across the whole project rather than just the current script for defined functions?

查看选择的答案

响应

5 回复
Yasin Ali

Hi,

Could you please attach the log.

Alan Buch

By "log" I think you mean the contents of the "Problems" tab.  Here it is below... In this post, I added line numbers for reference.  I have several .js files; weather.js, BHD08.js, utility.js, etc.  I've bolded a great example of the "false positive" which can be seen at lines 4 and 5 below... I've defined a function called "getTemperature" in the weather.js file.  I use the getTemperature function in my BHD08.js.  This code works fine.  Yet, Tizen Studio 2.3 thinks that there's an issue... On line 4 it says that I've defined the getTemperature function in weather.js but that it is "never used".  But not true.  I do use it in BHD08.js.  Not surprisingly, it also thinks that my use in BHD08.js of that same function (that it said I didn't use!) "is not defined".


Description Resource Path Location Type

  1. 'ev' is defined but never used. BHD08.js /BHD08/js line 521 Tizen JS Problem
  2. 'getSunriseTime' is defined but never used. weather.js /BHD08/js line 85 Tizen JS Problem
  3. 'getSunsetTime' is defined but never used. weather.js /BHD08/js line 100 Tizen JS Problem
  4. 'getTemperature' is defined but never used. weather.js /BHD08/js line 19 Tizen JS Problem
  5. 'getTemperature' is not defined. BHD08.js /BHD08/js line 269 Tizen JS Problem
  6. 'getWeatherAtLocationAsync' is defined but never used. weather.js /BHD08/js line 119 Tizen JS Problem
  7. 'getWeatherAtLocationAsync' is not defined. BHD08.js /BHD08/js line 252 Tizen JS Problem
  8. 'getWeatherCity' is defined but never used. weather.js /BHD08/js line 40 Tizen JS Problem
  9. 'getWeatherCity' is not defined. BHD08.js /BHD08/js line 271 Tizen JS Problem
  10. 'getWeatherIcon' is defined but never used. weather.js /BHD08/js line 70 Tizen JS Problem
  11. 'getWeatherIcon' is not defined. BHD08.js /BHD08/js line 267 Tizen JS Problem
  12. 'getWeatherText' is defined but never used. weather.js /BHD08/js line 55 Tizen JS Problem
  13. 'getWeatherText' is not defined. BHD08.js /BHD08/js line 270 Tizen JS Problem
  14. 'init' is defined but never used. BHD08.js /BHD08/js line 668 Tizen JS Problem
  15. 'init' is not defined. start.js /BHD08/js line 20 Tizen JS Problem
  16. 'lastKnownCity' is defined but never used. BHD08.js /BHD08/js line 14 Tizen JS Problem
  17. 'padl' is defined but never used. utility.js /BHD08/js line 1 Tizen JS Problem
  18. 'padl' is not defined. BHD08.js /BHD08/js line 135 Tizen JS Problem
  19. 'padl' is not defined. BHD08.js /BHD08/js line 150 Tizen JS Problem
  20. 'padl' is not defined. BHD08.js /BHD08/js line 170 Tizen JS Problem
  21. 'padl' is not defined. BHD08.js /BHD08/js line 200 Tizen JS Problem
  22. 'padl' is not defined. BHD08.js /BHD08/js line 201 Tizen JS Problem
  23. 'padl' is not defined. BHD08.js /BHD08/js line 57 Tizen JS Problem
  24. 'padl' is not defined. BHD08.js /BHD08/js line 61 Tizen JS Problem
  25. 'padl' is not defined. BHD08.js /BHD08/js line 621 Tizen JS Problem
  26. 'padl' is not defined. BHD08.js /BHD08/js line 622 Tizen JS Problem
  27. 'padl' is not defined. BHD08.js /BHD08/js line 624 Tizen JS Problem
  28. 'padl' is not defined. BHD08.js /BHD08/js line 727 Tizen JS Problem
  29. 'padl' is not defined. BHD08.js /BHD08/js line 727 Tizen JS Problem
  30. 'padl' is not defined. BHD08.js /BHD08/js line 728 Tizen JS Problem
  31. 'padl' is not defined. BHD08.js /BHD08/js line 728 Tizen JS Problem
  32. 'padl' is not defined. BHD08.js /BHD08/js line 728 Tizen JS Problem
  33. 'replicate' is defined but never used. BHD08.js /BHD08/js line 735 Tizen JS Problem
  34. 'updateSun' is defined but never used. BHD08.js /BHD08/js line 180 Tizen JS Problem
  35. 'wait' is defined but never used. utility.js /BHD08/js line 16 Tizen JS Problem
  36. 'wait' is not defined. BHD08.js /BHD08/js line 261 Tizen JS Problem
  37. 'weatherInformation' is not defined. BHD08.js /BHD08/js line 258 Tizen JS Problem
  38. 'weatherInformation' is not defined. BHD08.js /BHD08/js line 264 Tizen JS Problem
     
Yasin Ali

Hi,

Check out how you added B.js in A.js(referencing B.js within A.js).
Add only A.js and call a function that extends
to B.js. Make a simple test function, nothing
complicated. Then see what error/log emerge.
Then add two js and observe log.

Mark as answer
GEUNSOO KIM

it sounds like" jslint" warning problem.

put the follwoing line on top of the B.js (lets assume that "Bfunc" and "BObject" are what you want to share with A.js)

/* exported Bfunc, BObject */

Then put the following line on top of the A.js

/* global Bfunc, BObject */

After that it will not generate the warning anymore.

but be careful not to make runtime "undefined" error.

 

Alan Buch

YES!  You nailed it!  Thanks for the response and the answer!!