Skip to content

Commit ad7ecef

Browse files
committed
Ship support for decorators in source code at parsing level
1 parent bd50179 commit ad7ecef

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

packages/webdoc-parser/src/symbols-babel/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const defaultPreset = [
1616
"classPrivateMethods",
1717
"classPrivateProperties",
1818
"classProperties",
19+
["decorators", {decoratorsBeforeExport: true}],
1920
"doExpressions",
2021
"dynamicImport",
2122
"exportDefaultFrom",

packages/webdoc-parser/test/lang-js.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,17 @@ describe("@webdoc/parser.LanguageIntegration{@lang js}", function() {
123123
`),
124124
).to.not.throw();
125125
});
126+
127+
it("should work with decorators", function() {
128+
const symtree = buildSymbolTree(`
129+
class DecoratorGarden {
130+
@decorator({ withParam: 'some-value' })
131+
decorated() {
132+
133+
}
134+
}
135+
`);
136+
137+
expect(symtree.members[0].members.length).to.equal(1);
138+
});
126139
});

packages/webdoc-parser/test/lang-ts.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,17 @@ describe("@webdoc/parser.LanguageIntegration{@lang ts}", function() {
146146
expect(specializedArrayBufferImpl.meta.implements[0]).to.equal("Special.IArrayBuffer");
147147
expect(specializedArrayBufferImpl.meta.extends[0]).to.equal("Special.ArrayBuffer");
148148
});
149+
150+
it("should work with decorators", function() {
151+
const symtree = buildSymbolTree(`
152+
class DecoratorGarden {
153+
@decorator({ withParam: 'some-value' })
154+
decorated() {
155+
156+
}
157+
}
158+
`, "*.ts");
159+
160+
expect(symtree.members[0].members.length).to.equal(1);
161+
});
149162
});

0 commit comments

Comments
 (0)