简体   繁体   English

Eclipse JSDT对象文字和Firefox

[英]Eclipse JSDT Object Literal and firefox

I'm using the Eclipse editor with JSDT to work through some Firefox add-on examples. 我正在使用带有JSDT的Eclipse编辑器来研究一些Firefox附加示例。 The following code generates errors. 以下代码生成错误。

const {Cc, Ci} = require("chrome");

var downloadManager = Cc["@mozilla.org/download-manager;1"]
.getService(Ci.nsIDownloadManager);

The first line gives the error - Syntax error on token "}", delete this token 第一行给出错误-令牌“}”上的语法错误,删除该令牌

The last line gives the error - Syntax error, insert "}" to complete Block 最后一行给出错误-语法错误,插入“}”以完成块

Is there something wrong with this code or is it JSDT that is wrong? 这段代码有什么问题吗?或者是JSDT错了吗?

It seems that you are using ES6 syntax code and JSDT Validator doesn't support this ECMA version (so it's a problem with JSDT). 似乎您正在使用ES6语法代码,并且JSDT Validator不支持此ECMA版本(因此JSDT存在问题)。 Your issue is the same than EcmaScript 6 - Tern IDE for Eclipse validation errors 您的问题与EcmaScript 6相同-Eclipse的Tern IDE验证错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM