Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354160

Summary: [validation] Anonymous functions not executed immediately show syntax error
Product: [WebTools] JSDT Reporter: Christian Hammer <hammer>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: NEW --- QA Contact: Chris Jaun <cmjaun>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Christian Hammer CLA 2011-08-08 12:09:47 EDT
Build Identifier: I20110613-1736

An anonymous function that is not called immediately gets tagged with an error message:

Syntax error on token "function", Identifier expected after this token

When calling this function directly this error goes away. However, the file containing the function might be loaded and fed to an eval construct, which assigns the function to a variable. So while this is a rather peculiar case, it is not a JS error but should rather raise a warning that this is potentially a no-op.


Reproducible: Always

Steps to Reproduce:
function(x) {
    return x+42;
};