ES6 not supported in Closure Compiler

ecmascript-6, google-closure-compiler, javascript

Solution

It's because you are using Computed Property Names in the literal object:

{ ['c']: C, ['r']: R }

An es5 compatible replacement might be:

var TheCellRef = LeadImport2ExcelLibrary['utils']['encode_cell']({ "c": C, "r": R });

Problem

I'm using Google Closure Compiler and I'm getting the following error: ES6_FEATURE: this language feature is only supported in es6 mode: computed property. Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT to enable ES6 features. The line that triggers this error is this one: ``` var TheCellRef = LeadImport2ExcelLibrary['utils']['encode_cell']({ ['c']: C, ['r']: R }); ``` Basically I'm passing an object that I'm creating on the same line. I know I could simply add the support for ES6 in the JavaScript source header but I was wondering why this error is coming up and how to fix it?

Original source