-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] SyntaxError: Identifier '_class' has already been declared #774
Labels
Comments
I've also dumped the source after transformation with the dbux plugin: var _defineProperty = require("@babel/runtime/helpers/defineProperty");
var _dbux = _dbux_init(
(typeof __dbux__ !== "undefined" && __dbux__) || require("@dbux/runtime")
);
var _cid = _dbux.getProgramContextId();
var _al = _dbux.getArgLength,
_af = _dbux.arrayFrom,
_uot = _dbux.unitOfType,
_diph = _dbux.DefaultInitializerPlaceholder,
_pI = _dbux.pushImmediate,
_pF = _dbux.popFunction,
_pFI = _dbux.popFunctionInterruptable,
_par = _dbux.registerParams,
_tr = _dbux.traceReturn,
_tra = _dbux.traceReturnAsync,
_tt = _dbux.traceThrow,
_tid = _dbux.newTraceId,
_td = _dbux.traceDeclaration,
_te = _dbux.traceExpression,
_tev = _dbux.traceExpressionVar,
_twv = _dbux.traceWriteVar,
_tct = _dbux.traceCatch,
_tctI = _dbux.traceCatchInterruptable,
_tf = _dbux.traceFinally,
_tfI = _dbux.traceFinallyInterruptable,
_tme = _dbux.traceExpressionME,
_tmeo = _dbux.traceExpressionMEOptional,
_twme = _dbux.traceWriteME,
_tdme = _dbux.traceDeleteME,
_tue = _dbux.traceUpdateExpressionVar,
_tume = _dbux.traceUpdateExpressionME,
_bce = _dbux.traceBCE,
_a = _dbux.traceArg,
_tsa = _dbux.traceSpreadArg,
_tcr = _dbux.traceCallResult,
_tae = _dbux.traceArrayExpression,
_toe = _dbux.traceObjectExpression,
_tfi = _dbux.traceForIn,
_tc = _dbux.traceClass,
_ti = _dbux.traceInstance,
_aw = _dbux.preAwait,
_aw2 = _dbux.wrapAwait,
_aw3 = _dbux.postAwait,
_yi = _dbux.preYield,
_yi2 = _dbux.wrapYield,
_yi3 = _dbux.postYield,
_tp = _dbux.tracePattern,
_apu = _dbux.addPurpose;
try {
var _class;
var _t3_, _t4_;
class _class {
constructor() {
_ti(this, (_t3_ = _tid(3)), []);
}
}
_class = _class;
_defineProperty(Foo, "_dbux_class", function () {
_tc(_class, (_t4_ = _tid(4)), [], []);
});
_class._dbux_class(), delete _class._dbux_class;
_dbux.t(5);
} finally {
_dbux.popProgram();
}
function _dbux_init(dbuxRuntime) {
if (!dbuxRuntime.initProgram) {
throw new Error(
'[@dbux/runtime] "initProgram" unavailable in "for-bad.js"'
);
}
return dbuxRuntime.initProgram(
{
program: {
_staticId: 1,
loc: {
start: { line: 1, column: 0, index: 0 },
end: { line: 2, column: 0, index: 14 },
},
type: 1,
name: "for-bad.js",
displayName: "for-bad.js",
fileName: "for-bad.js",
filePath:
"/Users/dmaretskyi/.vscode/extensions/domi.dbux-code-0.7.9/dbux_projects/getting-started/findLongestWordLength/for-bad.js",
programIndex: 1,
},
contexts: [
{
_staticId: 1,
loc: {
start: { line: 1, column: 0, index: 0 },
end: { line: 2, column: 0, index: 14 },
},
type: 1,
name: "for-bad.js",
displayName: "for-bad.js",
fileName: "for-bad.js",
filePath:
"/Users/dmaretskyi/.vscode/extensions/domi.dbux-code-0.7.9/dbux_projects/getting-started/findLongestWordLength/for-bad.js",
programIndex: 1,
},
],
traces: [
{
loc: {
start: { line: 1, column: 0, index: 0 },
end: { line: 1, column: 0, index: 0 },
},
_traceId: 1,
_staticContextId: 1,
type: 1,
},
{
loc: {
start: { line: 2, column: 0, index: 14 },
end: { line: 2, column: 0, index: 14 },
},
_traceId: 2,
_staticContextId: 1,
type: 2,
},
{
displayName: "{}",
loc: {
start: { line: 1, column: 10, index: 10 },
end: { line: 1, column: 12, index: 12 },
},
_traceId: 3,
_staticContextId: 1,
type: 45,
data: { privateMethods: [] },
dataNode: { isNew: true },
},
{
displayName: "class Foo {}",
loc: {
start: { line: 1, column: 0, index: 0 },
end: { line: 1, column: 12, index: 12 },
},
_traceId: 4,
_staticContextId: 1,
type: 43,
data: { name: "Foo", staticMethods: [], publicMethods: [] },
dataNode: { isNew: true },
},
{
loc: {
start: { line: 2, column: 0, index: 14 },
end: { line: 2, column: 0, index: 14 },
},
_traceId: 5,
_staticContextId: 1,
type: 22,
},
],
loops: [],
},
{}
);
} |
Elimiminating the usage of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Bug Summary
Getting
SyntaxError: Identifier '_class' has already been declared
after adding a class declarationSteps To Reproduce
Expected behavior
Not crash.
Actual behavior
Crashes with an error
SyntaxError: Identifier '_class' has already been declared
.Attachments
Relevant Code
Dbux Output Log
Dbux Runtime (Console) Log
Screenshots
System (please complete the following information):
"@babel/plugin-proposal-class-properties": "^7.18.6"
node 16
Additional context
After installing the vscode extension I was getting an error about
@babel/plugin-proposal-class-properties
package missing. So I've installed it manually in the tutorial excercises workspace:The text was updated successfully, but these errors were encountered: