@sap/cds-compiler 5.7.0 → 5.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@
7
7
  Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
 
10
+ ## Version 5.7.4 - 2025-02-05
11
+
12
+ ### Fixed
13
+
14
+ - New CDL Parser (option `newParser: true`)
15
+ + Improve code completion
16
+ + Fix further edge cases in error recovery
17
+
18
+ ## Version 5.7.2 - 2025-01-30
19
+
20
+ ### Fixed
21
+
22
+ - Fix edge case in error recovery of the new CDL parser (option `newParser: true`)
23
+
24
+
10
25
  ## Version 5.7.0 - 2025-01-24
11
26
 
12
27
  ### Added
@@ -98,7 +98,7 @@ function stringOrRaw( val ) {
98
98
  */
99
99
  function combinedLocation( start, end ) {
100
100
  if (!start || !start.location)
101
- return end.location;
101
+ return end?.location;
102
102
  else if (!end || !end.location)
103
103
  return start.location;
104
104
  const loc = {
package/lib/base/model.js CHANGED
@@ -168,8 +168,6 @@ function forEachMember( construct, callback, target ) {
168
168
  function forEachMemberRecursively( construct, callback, target ) {
169
169
  forEachMember( construct, ( member, memberName, prop ) => {
170
170
  callback( member, memberName, prop );
171
- if (Array.isArray(member.$duplicates)) // redefinitions
172
- member.$duplicates.forEach( o => callback( o, memberName, prop ) );
173
171
  // Descend into nested members, too
174
172
  forEachMemberRecursively( member, callback );
175
173
  }, target);
@@ -177,15 +175,16 @@ function forEachMemberRecursively( construct, callback, target ) {
177
175
 
178
176
  // Apply function `callback` to all objects in dictionary `dict`, including all
179
177
  // duplicates (found under the same name). Function `callback` is called with
180
- // the following arguments: the object, the name, and -if it is a duplicate-
178
+ // the following arguments: the object, the name, and - if it is a duplicate -
181
179
  // the array index and the array containing all duplicates.
182
180
  function forEachGeneric( obj, prop, callback ) {
183
181
  const dict = obj[prop];
184
182
  for (const name in dict) {
185
183
  obj = dict[name];
184
+ const { $duplicates } = obj;
186
185
  callback( obj, name, prop );
187
- if (Array.isArray(obj.$duplicates)) // redefinitions
188
- obj.$duplicates.forEach( o => callback( o, name, prop ) );
186
+ if (Array.isArray($duplicates)) // redefinitions
187
+ $duplicates.forEach( o => callback( o, name, prop ) );
189
188
  }
190
189
  }
191
190
 
@@ -1155,6 +1155,9 @@ function define( model ) {
1155
1155
  setLink( elem, '_block', bl );
1156
1156
  const existing = parent[prop]?.[name];
1157
1157
  const add = construct !== parent && (!existing || elem.$inferred !== 'include');
1158
+ // don't dump with `entity T {}; extend T with { extend e {}; e {}; e {} };`:
1159
+ if (elem.$duplicates === true && add)
1160
+ elem.$duplicates = null;
1158
1161
  setMemberParent( elem, name, parent, add && prop );
1159
1162
  // console.log(message( null, elem.location, elem, {}, 'Info', 'INIT').toString())
1160
1163
  checkRedefinition( elem );
@@ -1459,7 +1459,7 @@ function resolve( model ) {
1459
1459
  type = getOrigin( type );
1460
1460
  const err = message( 'ref-undefined-enum', [ sym.location, assignment ],
1461
1461
  { id: sym.id, type } );
1462
- if (options.newParser)
1462
+ if (options.newParser || options.newparser)
1463
1463
  attachAndEmitValidNames( err, symbols );
1464
1464
  }
1465
1465
  }