jalexiscv / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

Eclipse "Syntax error on token "new", ArrayLiteralHeader expected after this token", l. 19 of v1.0.2 of base2.js #144

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download v1.0.2 of base2.js 
2. Create an Eclipse jsdt Web project which includes this source
3. Try opening the file

What is the expected output? What do you see instead?

I would expect to be able to view the base2.js file in Eclipse without 
validation errors.

What version of the product are you using? On what operating system?

v1.0.2 of base2.js 

Eclipse IDE for JavaScript Web Developers.
Version: Indigo Service Release 2
Build id: 20120208-2150
Version: 1.4.2.20120206-1433

Please provide any additional information below.

Repros on Mac and XP Pc's (as you would expect for an Eclipse Java app).

Original issue reported on code.google.com by michael.maguire@gmail.com on 22 Feb 2012 at 11:44

GoogleCodeExporter commented 9 years ago
This is the line Eclipse's knickers get in a twist about:

new function(_no_shrink_) { ///////////////  BEGIN: CLOSURE  ///////////////

Original comment by michael.maguire@gmail.com on 22 Feb 2012 at 11:45

GoogleCodeExporter commented 9 years ago
Oh, I also get at l. 1675 (last line):

}; ////////////////////  END: CLOSURE  /////////////////////////////////////

the error:

Syntax error, insert "]" to complete  NewExpression

Original comment by michael.maguire@gmail.com on 22 Feb 2012 at 11:49

GoogleCodeExporter commented 9 years ago
The following patch seems to fix it (and my code which calls into base2.js 
still seems to work).  Is this a case of Eclipse's JavaScript parser not being 
up-to-date to the latest evolution of the spec, or is it being too picky?

Index: base2.js
===================================================================
--- base2.js    (revision 32027)
+++ base2.js    (working copy)
@@ -16,7 +16,7 @@
   namespace: ""
 };

-new function(_no_shrink_) { ///////////////  BEGIN: CLOSURE  ///////////////
+(new function(_no_shrink_) { ///////////////  BEGIN: CLOSURE  ///////////////

 // =========================================================================
 // base2/header.js
@@ -1672,4 +1672,4 @@
 lang.base = base;
 lang.extend = extend;

-}; ////////////////////  END: CLOSURE  /////////////////////////////////////
\ No newline at end of file
+}) ////////////////////  END: CLOSURE  /////////////////////////////////////
\ No newline at end of file

Original comment by michael.maguire@gmail.com on 22 Feb 2012 at 1:57