From 8234ce2712985be187dade4c8c98ae7bf3dc74ae Mon Sep 17 00:00:00 2001 From: Julian Rosse Date: Sun, 25 Jun 2017 13:39:45 -0500 Subject: [PATCH] error message for implicit call [Fixes #4283] --- lib/coffee-script/rewriter.js | 2 +- src/rewriter.coffee | 2 +- test/error_messages.coffee | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/coffee-script/rewriter.js b/lib/coffee-script/rewriter.js index a12c3ae584..8e7a6183a9 100644 --- a/lib/coffee-script/rewriter.js +++ b/lib/coffee-script/rewriter.js @@ -213,7 +213,7 @@ ours: true } ]); - tokens.splice(idx, 0, generate('CALL_START', '(')); + tokens.splice(idx, 0, generate('CALL_START', '(', ['', 'implicit function call', token[2]])); if (j == null) { return i += 1; } diff --git a/src/rewriter.coffee b/src/rewriter.coffee index 0d173f04ca..ef409cb417 100644 --- a/src/rewriter.coffee +++ b/src/rewriter.coffee @@ -162,7 +162,7 @@ exports.Rewriter = class Rewriter startImplicitCall = (j) -> idx = j ? i stack.push ['(', idx, ours: yes] - tokens.splice idx, 0, generate 'CALL_START', '(' + tokens.splice idx, 0, generate 'CALL_START', '(', ['', 'implicit function call', token[2]] i += 1 if not j? endImplicitCall = -> diff --git a/test/error_messages.coffee b/test/error_messages.coffee index d09acb025d..0116c55616 100644 --- a/test/error_messages.coffee +++ b/test/error_messages.coffee @@ -1319,3 +1319,12 @@ test "#4248: Unicode code point escapes", -> '\\u{a}\\u{1111110000}' \ ^\^^^^^^^^^^^^^ ''' + +test "#4283: error message for implicit call", -> + assertErrorFormat ''' + console.log {search, users, contacts users_to_display} + ''', ''' + [stdin]:1:29: error: unexpected implicit function call + console.log {search, users, contacts users_to_display} + ^^^^^^^^ + '''