This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 392666 - Local method declaration causes problems with Shrinksafe
Summary: Local method declaration causes problems with Shrinksafe
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Editor (show other bugs)
Version: 1.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 11:30 EDT by Adam Peller CLA
Modified: 2012-11-08 11:35 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Peller CLA 2012-10-23 11:30:56 EDT
The definition of the clone method in the editor's textStyler module seems to cause problems with Dojo Shrinksafe, namely the construct:

  clone: function clone(){...}

and use of the local reference 'clone' in the code.  I'm not sure what the ECMAScript spec has to say about this.  Isn't this form only supposed to be used at the global scope?  Even if it's a Shrinksafe bug, it's easier to fix the code.  clone does not have any reference to the object instance and is very easily defined as a separate function within the closure.  Please consider making this change. Thanks

https://github.com/maqetta/maqetta/commit/bf88b9d9e5f6a2c2179745868402560efd81f94f
Comment 1 Simon Kaegi CLA 2012-10-23 11:37:58 EDT
Sure that's fine will do in master as soon as things open up again as we're about to declare 1.0. 

The code as it stands would create "clone" in the lexical scope so there is no difference if we extract it and put it at the top.
Comment 2 Silenio Quarti CLA 2012-11-08 10:43:40 EST
Mark, this is a problem in the textMateStyler.js.  I thought this was a problem in textStyler.js which also defines a clone method, but the name there is _clone(), which seems to be ok.
Comment 3 Mark Macdonald CLA 2012-11-08 11:35:46 EST
Fixed

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=35073938aa4103ab95a4b90f81227285ae1477e2

FWIW, the construct is a bit unusual but is valid js -- it just provides a way to name a function used in an object literal expression so that it can recursively call itself.