@@ -1295,6 +1295,13 @@ var jsonata = (function() {
1295
1295
}
1296
1296
for ( var ii = 0 ; ii < matches . length ; ii ++ ) {
1297
1297
var match = matches [ ii ] ;
1298
+ if ( match && ( match . isPrototypeOf ( result ) || match instanceof Object . constructor ) ) {
1299
+ throw {
1300
+ code : "D1010" ,
1301
+ stack : ( new Error ( ) ) . stack ,
1302
+ position : expr . position
1303
+ } ;
1304
+ }
1298
1305
// evaluate the update value for each match
1299
1306
var update = yield * evaluate ( expr . update , match , environment ) ;
1300
1307
// update must be an object
@@ -1539,7 +1546,7 @@ var jsonata = (function() {
1539
1546
if ( typeof err . token == 'undefined' && typeof proc . token !== 'undefined' ) {
1540
1547
err . token = proc . token ;
1541
1548
}
1542
- err . position = proc . position ;
1549
+ err . position = proc . position || err . position ;
1543
1550
}
1544
1551
throw err ;
1545
1552
}
@@ -1971,6 +1978,7 @@ var jsonata = (function() {
1971
1978
"T1007" : "Attempted to partially apply a non-function. Did you mean ${{{token}}}?" ,
1972
1979
"T1008" : "Attempted to partially apply a non-function" ,
1973
1980
"D1009" : "Multiple key definitions evaluate to same key: {{value}}" ,
1981
+ "D1010" : "Attempted to access the Javascript object prototype" , // Javascript specific
1974
1982
"T1010" : "The matcher function argument passed to function {{token}} does not return the correct object structure" ,
1975
1983
"T2001" : "The left side of the {{token}} operator must evaluate to a number" ,
1976
1984
"T2002" : "The right side of the {{token}} operator must evaluate to a number" ,
0 commit comments