Skip to content

Commit 66d4c30

Browse files
release: TypeScript2Cxx v0.7.0 - Modern JavaScript Operators and Advanced Features
Major release introducing 5 new JavaScript operators and language features: ### New Features - Computed property names in object literals ({[key]: value}) - IIFE (Immediately Invoked Function Expressions) support - instanceof operator for runtime type checking - in operator for property existence checking - delete operator for property deletion - Enhanced array higher-order methods (forEach, find, findIndex, some, every, includes) ### Runtime Enhancements - Added comprehensive operator overloads to js::any (*, /, -, %, ==, \!=, >, <, >=, <=) - Implemented runtime helper functions for new operators - Enhanced object entries() method for iteration support - Fixed C++ reserved keyword escaping with underscore suffix ### Code Generation Improvements - Better lambda capture handling for global scope operations - Enhanced transformer with new expression handlers - Improved array method detection in code generator - Fixed === operator mapping to == in C++ generation ### Test Coverage - 11 comprehensive test cases for computed properties - Dedicated IIFE test coverage in functions.spec.ts - in/delete operator tests in operators.spec.ts - End-to-end compilation and execution testing ### Development Environment - Updated Deno configuration with proper exclude patterns - Streamlined build tools to process only relevant files - Enhanced .gitignore for build artifacts and generated files All features are fully implemented with proper runtime support and comprehensive test coverage.
1 parent 5419792 commit 66d4c30

File tree

9 files changed

+343
-19
lines changed

9 files changed

+343
-19
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,14 @@ Thumbs.db
2020

2121
# Dependencies
2222
/node_modules/
23+
24+
# Test and build outputs
25+
/**/build/
26+
/**/CMakeFiles/
27+
/test-output/
28+
/cov_profile/
29+
/coverage.lcov
30+
*.exe
31+
32+
# Deno generated files
33+
/.deno/

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.7.0] - 2025-01-08
11+
12+
### Added
13+
14+
- feat: Array higher-order methods (forEach, find, findIndex, some, every, includes)
15+
- feat: Computed property names in object literals (`{[key]: value}`)
16+
- feat: IIFE (Immediately Invoked Function Expressions) support
17+
- feat: instanceof operator for runtime type checking
18+
- feat: in operator for property existence checking
19+
- feat: delete operator for property deletion
20+
- feat: Full arrow function support with lambda generation
21+
- feat: Object rest properties in destructuring (`const {a, ...rest} = obj`)
22+
- feat: Array spread in array literals (`[...arr1, ...arr2]`)
23+
24+
### Fixed
25+
26+
- fix: C++ reserved keywords properly escaped with underscore suffix
27+
- fix: Added missing arithmetic operators to js::any (*, /, -, %)
28+
- fix: Fixed === operator mapping to == in C++ generation
29+
- fix: Lambda capture issues resolved for global scope operations
30+
- fix: Better array method detection in code generator
31+
32+
### Enhanced
33+
34+
- Enhanced js::any with comprehensive operator overloads
35+
- Improved runtime helper functions for new operators
36+
- Better type safety in array method implementations
37+
1038
## [0.6.0] - 2025-01-08
1139

1240
### Added

RELEASE_NOTES_v0.7.x.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
# Release Notes - v0.7.x Series
22

3-
## Version 0.7.0 - Arrow Functions and Array Methods (2025-01-14)
3+
## Version 0.7.0 - Modern JavaScript Operators and Functions (2025-01-08)
44

5-
Major update introducing arrow functions and comprehensive array higher-order methods support.
5+
Major update introducing modern JavaScript operators, arrow functions, IIFE support, and comprehensive array higher-order methods.
66

77
### Added
88

99
#### Arrow Functions
10+
1011
- Full arrow function support with lambda generation
1112
- Lexical `this` binding with capture modes
1213
- Single expression and block body syntax
1314
- Type inference for arrow function parameters
1415
- Proper return type deduction
1516

17+
#### Modern JavaScript Operators
18+
19+
- **Computed Property Names** - Dynamic object keys (`{[key]: value}`)
20+
- **IIFE Support** - Immediately Invoked Function Expressions with lambda wrappers
21+
- **instanceof operator** - Runtime type checking with prototype chain traversal
22+
- **in operator** - Property existence checking for objects and arrays
23+
- **delete operator** - Property deletion with boolean return values
24+
1625
#### Array Higher-Order Methods
26+
1727
- `forEach()` - Execute function for each element
1828
- `find()` - Find first element matching predicate
1929
- `findIndex()` - Find index of first matching element
@@ -23,26 +33,33 @@ Major update introducing arrow functions and comprehensive array higher-order me
2333
- Enhanced `map()`, `filter()`, `reduce()` with js::any support
2434

2535
#### Destructuring Enhancements
36+
2637
- Object rest properties (`const { a, ...rest } = obj`)
2738
- Array rest elements (`const [first, ...rest] = arr`)
2839
- Lambda-wrapped rest object generation for global scope
2940
- Proper entries() method for object iteration
3041

3142
#### Spread Operator
43+
3244
- Array spread in array literals (`[...arr1, ...arr2]`)
3345
- Concatenation support for spread operations
3446
- Empty array handling with explicit type specification
3547

3648
### Fixed
3749

3850
#### Code Generation
51+
3952
- C++ reserved keywords now properly escaped with underscore suffix
4053
- Variable names checked against full C++ keyword list
4154
- Fixed object rest properties at global scope using lambda wrappers
4255
- Corrected === and !== operator mapping to == and !=
56+
- Added computed property name generation (`{[expr]: value}`)
57+
- IIFE lambda wrapper generation for immediate execution
58+
- Runtime helper function calls for instanceof, in, and delete operators
4359

4460
#### Runtime Library
45-
- Added missing arithmetic operators to js::any (*, /, -, %)
61+
62+
- Added missing arithmetic operators to js::any (*, /, -, %)
4663
- Added comparison operators to js::any (>, <, >=, <=, ==, !=)
4764
- Added operator overloads for js::any with js::number
4865
- Enhanced js::any to delegate array methods to underlying arrays
@@ -51,6 +68,7 @@ Major update introducing arrow functions and comprehensive array higher-order me
5168
### Enhanced
5269

5370
#### Developer Experience
71+
5472
- Better array method detection in code generator
5573
- Improved identifier mapping for reserved words
5674
- More comprehensive operator support in runtime
@@ -59,6 +77,7 @@ Major update introducing arrow functions and comprehensive array higher-order me
5977
### Technical Details
6078

6179
#### Runtime Additions
80+
6281
```cpp
6382
// New array methods in js::array<T>
6483
template<typename Func> void forEach(Func&& func) const;
@@ -79,9 +98,18 @@ bool operator>=(const number& other) const;
7998
bool operator<=(const number& other) const;
8099
bool operator==(const number& other) const;
81100
bool operator!=(const number& other) const;
101+
102+
// New runtime helper functions
103+
bool js_instanceof(const js::any& obj, const js::any& constructor);
104+
bool js_in(const std::string& prop, const js::any& obj);
105+
bool js_delete(js::any& obj, const std::string& prop);
106+
107+
// Enhanced object methods
108+
std::vector<std::pair<std::string, js::any>> entries() const;
82109
```
83110
84111
#### Breaking Changes
112+
85113
None - All changes are additive or bug fixes.
86114
87115
### Known Limitations
@@ -96,4 +124,4 @@ No migration required. Existing code continues to work with enhanced functionali
96124
97125
### Contributors
98126
99-
This release represents significant progress in JavaScript feature parity, bringing modern array operations and arrow functions to the C++ transpilation.
127+
This release represents significant progress in JavaScript feature parity, bringing modern array operations, arrow functions, IIFE support, and essential JavaScript operators (instanceof, in, delete) to the C++ transpilation. With computed property names and comprehensive operator support, v0.7.0 enables more dynamic and idiomatic JavaScript patterns in C++ output.

TODO.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Based on analysis of both reference implementations:
257257
- ✅ Function types (v0.1.1)
258258
- [ ] Higher-order functions
259259
- ✅ Arrow functions with proper `this` binding (v0.2.0)
260-
- [ ] IIFE (Immediately Invoked Function Expressions)
260+
- IIFE (Immediately Invoked Function Expressions) (v0.7.0)
261261

262262
- [x] **Modern JavaScript Operators** ✅ PARTIAL (v0.1.0-v0.5.4)
263263
- ✅ Nullish coalescing (??) (v0.5.4-dev)
@@ -273,7 +273,7 @@ Based on analysis of both reference implementations:
273273
- ✅ Rest parameters (...) (v0.5.3-dev)
274274
- ✅ Default parameters (v0.5.3-dev)
275275
- ✅ Dynamic property access (v0.2.0)
276-
- [ ] Computed property names
276+
- Computed property names (v0.7.0)
277277
- ✅ Object.assign/Object.create (v0.3.0)
278278
- ✅ Object.keys/values/entries (v0.3.0)
279279
- ✅ Array.from/Array.of (v0.3.0)
@@ -289,10 +289,10 @@ Based on analysis of both reference implementations:
289289
- String.prototype.matchAll
290290

291291
- [x] **Other Language Features** ✅ PARTIAL (v0.2.0-v0.4.0)
292-
- [ ] delete operator
293-
- [ ] instanceof operator (runtime)
292+
- [x] delete operator (v0.7.0)
293+
- [x] instanceof operator (runtime) (v0.7.0)
294294
- ✅ typeof operator (runtime) (v0.4.0)
295-
- [ ] in operator
295+
- [x] in operator (v0.7.0)
296296
- [ ] void operator
297297
- Symbol support
298298
- Symbol.iterator protocol

deno.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,29 @@
2929
"tags": ["recommended"],
3030
"exclude": ["no-explicit-any"]
3131
},
32-
"exclude": [".output/"]
32+
"exclude": [
33+
".output/",
34+
"node_modules/",
35+
"**/build/",
36+
"**/CMakeFiles/",
37+
"**/*.cpp",
38+
"**/*.h"
39+
]
3340
},
3441
"fmt": {
3542
"lineWidth": 100,
3643
"indentWidth": 2,
3744
"semiColons": true,
3845
"singleQuote": false,
3946
"proseWrap": "preserve",
40-
"exclude": [".output/"]
47+
"exclude": [
48+
".output/",
49+
"node_modules/",
50+
"**/build/",
51+
"**/CMakeFiles/",
52+
"**/*.cpp",
53+
"**/*.h"
54+
]
4155
},
4256
"imports": {
4357
"@std/": "https://deno.land/[email protected]/",
@@ -57,7 +71,14 @@
5771
},
5872
"test": {
5973
"include": ["tests/", "src/**/*.test.ts"],
60-
"exclude": ["tests/fixtures/", "tests/integration/"]
74+
"exclude": [
75+
"tests/fixtures/",
76+
"tests/integration/",
77+
".output/",
78+
"node_modules/",
79+
"**/build/",
80+
"**/CMakeFiles/"
81+
]
6182
},
6283
"bench": {
6384
"include": ["benchmarks/"]

0 commit comments

Comments
 (0)