Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Extending the DLTK/JavaScript parser/model

On 07.06.12 10:26:40, Andreas Pakulat wrote:
> On 07.06.12 09:19:34, Johan Compagner wrote:
> > Like alex already told you, that is perfectly doable in DLTK
> > we use it all over the place, because we have many many files on different
> > scopes (so forms.xxxx reference in 1 file is pointing to an xxxxx.js file
> > some where) or  on the same scope
> > this can all be done by IMemberEvaluator
> > with IValueCollection getTopValueCollection(ITypeInfoContext context) you
> > can return the complete top value collection (so all the files combined on
> > the same scope)
> > and with IValueCollection valueOf(ITypeInfoContext context, Element
> > member); you can tell dltk that for this element (like my forms.xxxxx
> > above) that this element is really another file.
> > 
> > See ValueCollectionFactory to create and merge IValueCollection objects.
> 
> Thanks for the hints - also to Alex. I actually tried to do that
> already, but got stuck at some point. I can't remember the exact details
> right now, but will retry that and come back with more concrete
> problems.

Indeed this works just fine, no idea what I did wrong in my last
attempt.

That leads me to the next question: Is there a way to modify the
top-value-collection of a script file when resolving a function in that
same script file? In our setup we have two functions 'source' and
'findFile' which are used to find other script files and source them
(i.e. run their content through eval(). It would be great if I could
somehow access the parameters given to these function calls inside the
script file and add the top-value-collection of the sourced script files
to the on in this script file.

Right now the code just adds all possibly-used script file collections,
but it would be nice if code-completion and warnings would help users
detect that a source(findFile()) line is missing.

The examples in the tests unfortunately always only add some static
content and they're using static properties in the script to trigger the
inclusion...

Andreas

-- 
Andreas Pakulat squish@xxxxxxxxxxxxx
froglogic GmbH - Automated UI and Web Testing


Back to the top