Skip to content

Commit 3ed3029

Browse files
committed
Fix origin override in ParseTreeToASTTransformer, release
1 parent 8271241 commit 3ed3029

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to this project from version 1.2.0 upwards are documented in this file.
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

5+
## [1.6.20] – 2024-03-26
6+
7+
### Fixed
8+
- Origin override in ParseTreeToASTTransformer
9+
510
## [1.6.19] – 2024-03-26
611

712
### Added

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "AST building blocks for TypeScript/JavaScript, part of the *lasu family, with optional integrations with ANTLR4 and Ecore.",
44
"author": "Strumenta s.r.l.",
55
"publisher": "strumenta",
6-
"version": "1.6.19",
6+
"version": "1.6.20",
77
"license": "Apache-2.0",
88
"keywords": [
99
"antlr",

src/mapping.ts

-13
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ export class ParseTreeToASTTransformer extends ASTTransformer {
1616
super(issues, allowGenericNode);
1717
}
1818

19-
/**
20-
* Performs the transformation of a node and, recursively, its descendants. In addition to the overridden method,
21-
* it also assigns the parseTreeNode to the AST node so that it can keep track of its position.
22-
* However, a node factory can override the parseTreeNode of the nodes it creates (but not the parent).
23-
*/
24-
transform(source?: any, parent?: Node): Node | undefined {
25-
const node = super.transform(source, parent);
26-
if (node && node.origin && source instanceof ParserRuleContext) {
27-
node.withParseTreeNode(source);
28-
}
29-
return node;
30-
}
31-
3219
getSource(node: Node, source: any): any {
3320
const origin = node.origin;
3421
if (origin instanceof ParseTreeOrigin) {

0 commit comments

Comments
 (0)