New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 686535 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Uncaught TypeError: (intermediate value)(...) is not a function

Reported by sunagbra...@gmail.com, Jan 29 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0

Steps to reproduce the problem:
1. call eval function with the following string:
2. (function() {})() (function() {})() 
OR
3. (function() {})() var a = 123;
OR
4. (function() {

(function() {})() (function() {})() 

})()

What is the expected behavior?
create two or more anonymous function to closure methods

What went wrong?
Uncaught TypeError: (intermediate value)(...) is not a function
    at <anonymous>:1:19

Did this work before? N/A 

Chrome version: 58.0.2996.0  Channel: canary
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 22.0 r0
 
Labels: Needs-Triage-M58

Comment 2 by tkent@chromium.org, Jan 30 2017

Components: -Blink Blink>JavaScript
Cc: sureshkumari@chromium.org
Labels: Needs-Feedback
Reporter@ could you please provide a sample Html/.js file to reproduce the issue from TE end.

Thanks..

Comment 4 by woxxom@gmail.com, Jan 30 2017

#3, simply paste "(function() {})() (function() {})()" without quotes in devtools console (Ctrl-Shift-I or F12) on a new tab page and press Enter. Same for the other samples.
#3, #4, Yes! thanks wox.
Cc: marja@chromium.org
Labels: -Needs-Feedback Needs-Bisect

Comment 7 by marja@chromium.org, Feb 1 2017

Status: WontFix (was: Unconfirmed)
This is working as intended.

2)

(function() {})() (function() {})()
               ^ function call
                   ^------------^ function call, parameter is a function
                                 ^^ another function call


So this is the same as:
foo(param1)(param2)(param3) which means calling function foo with param1, calling whatever that returns with param2 and so on.

And now foo(param1) is not a function, thus the error.

What you probably meant is this:

(function() {})(); (function() {})()

3) 

(function() {})() var a = 123;
                  ^^^ unexpected token

This is again foo() var a; which is a syntax error.


4) Same as 2), now the foo(param1)(param2)(param3) is simply passed in as a parameter.

                             
it makes a lot of sense, thanks marja! thanks guys.

Sign in to add a comment