Coder Social home page Coder Social logo

Comments (13)

andr3nun3s avatar andr3nun3s commented on May 22, 2024

Was this issue solved?

I've looked around a bit and haven't found this. I found some calls to the defaultValue() function so I guess this was solved.

from cesium.

mramato avatar mramato commented on May 22, 2024

There are still places where this is an issue, but they are hard to track down so we have been fixing them when we find them. If you feel like going through the code and looking for them and fixing them, that would be awesome. It's not just this.myValue = value || 12.0; but also if(myValue) where myValue is not a boolean, that needs to be fixed.

from cesium.

shunter avatar shunter commented on May 22, 2024

One thing to keep in mind, though, is that the defaultValue(a, b) function can introduce performance problems if b is not a constant value or primitive value, because both a and b must be evaluated in order to call the function. In cases where b is an allocated object, we need to stick with the typeof a !== 'undefined' ? a : b pattern. See this discussion for more details.

from cesium.

pjcozzi avatar pjcozzi commented on May 22, 2024

@Andre-Nunes if you are interested in this, you could start with a few files, which we could review to make sure you are heading in the right direction before updating everything. This would be a welcomed contribution.

from cesium.

andr3nun3s avatar andr3nun3s commented on May 22, 2024

@pjcozzi , I am really interested in this, it's a good way to start dwelling into the code base and prepare myself for GSoC.

I would really appreciate if someone pointed me in the right direction. For example on Cesium-hint.js:

var win = CodeMirror.cesiumWindow || window;
    if (context) {
      // If this is a property, see if it belongs to some object we can
      // find in the current environment.
      var obj = context.pop(), base;
      if (obj.className == "variable")
        base = win[obj.string];
      else if (obj.className == "string")
        base = "";
      else if (obj.className == "atom")
        base = 1;
      else if (obj.className == "function") {
        if (win.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
            (typeof win.jQuery == 'function'))
          base = win.jQuery();
        else if (win._ != null && (obj.string == '_') && (typeof win._ == 'function'))
          base = win._();
      }

Is wina suitable candidate for fix?

A different example this time on CubeMapEllipsoidTessellator.js

attributeName = attributeName || 'position';

This is probably not the best way to review code so any advice will be welcome.

from cesium.

mramato avatar mramato commented on May 22, 2024

Yes. Both win, context and attributeName are all cases where we should be performing a proper check.

from cesium.

andr3nun3s avatar andr3nun3s commented on May 22, 2024

I'll start by fixing those then. Should I open a pull request as soon as I fix those or that's just 'overkill'?

I've asked further questions about branching and "commit etiquette" on the forum. It's probability better to continue this discussion there.

from cesium.

emackey avatar emackey commented on May 22, 2024

Hang on, Cesium-hint.js is a special case. It's a modified copy of a third-party file, ThirdParty\CodeMirror-2.24\lib\util\javascript-hint.js, with some Cesium customizations. Because it's a fork of that file, I want to keep the customizations to a minimum, so it's upgradable. Please don't "fix" anything in that file, thanks!

from cesium.

mramato avatar mramato commented on May 22, 2024

@emackey Kind of offtopic but if that's the case, shouldn't Cesium-hint.js be in a Sandcastle/ThirdParty directory? And why not just keep it named javascript-hint.js?

from cesium.

emackey avatar emackey commented on May 22, 2024

Might be good to move it down into a new Sandcastle/Thirdparty folder, this issue seems to come up from time to time. Note that you'll have to mess with the jsHint options for Eclipse after you move or rename it. I do like the name Cesium-hint because the file contains more than just plain JavaScript hints, it's been customized for Cesium.

from cesium.

mramato avatar mramato commented on May 22, 2024

@Andre-Nunes For something like this you should either open a new issue or post a new message to the mailing list. Please do not post about an unrelated issue in some other issue, it makes things difficult to manage.

from cesium.

andr3nun3s avatar andr3nun3s commented on May 22, 2024

I believe this was solved with the above PRs, after #694 I've gone through most Source files as well, is there anywhere else I should look at?

from cesium.

mramato avatar mramato commented on May 22, 2024

While I'm sure there are some remaining cases that we'll find over time, I think the majority of them have been fixed. Thanks for the work @Andre-Nunes and @nobelium!

from cesium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.