duktape: Import v2.2.1
diff --git a/duktape/duk_config.h b/duktape/duk_config.h
index 3f217ef..51e973f 100644
--- a/duktape/duk_config.h
+++ b/duktape/duk_config.h
@@ -1,9 +1,9 @@
 /*
  *  duk_config.h configuration header generated by genconfig.py.
  *
- *  Git commit: a459cf3c9bd1779fc01b435d69302b742675a08f
- *  Git describe: v2.2.0
- *  Git branch: master
+ *  Git commit: 25420e773c5fbc50d5b46bf487fc45717e35b94f
+ *  Git describe: v2.2.1
+ *  Git branch: v2.2-maintenance
  *
  *  Supported platforms:
  *      - Mac OSX, iPhone, Darwin
@@ -2005,8 +2005,8 @@
 
 /* Boolean values are represented with the platform 'unsigned int'. */
 typedef duk_small_uint_t duk_bool_t;
-#define DUK_BOOL_MIN              DUK_SMALL_INT_MIN
-#define DUK_BOOL_MAX              DUK_SMALL_INT_MAX
+#define DUK_BOOL_MIN              DUK_SMALL_UINT_MIN
+#define DUK_BOOL_MAX              DUK_SMALL_UINT_MAX
 
 /* Index values must have at least 32-bit signed range. */
 typedef duk_int_t duk_idx_t;
diff --git a/duktape/duktape.c b/duktape/duktape.c
index 05e4b1d..ba55550 100644
--- a/duktape/duktape.c
+++ b/duktape/duktape.c
@@ -1,8 +1,8 @@
 /*
- *  Single source autogenerated distributable for Duktape 2.2.0.
+ *  Single source autogenerated distributable for Duktape 2.2.1.
  *
- *  Git commit a459cf3c9bd1779fc01b435d69302b742675a08f (v2.2.0).
- *  Git branch master.
+ *  Git commit 25420e773c5fbc50d5b46bf487fc45717e35b94f (v2.2.1).
+ *  Git branch v2.2-maintenance.
  *
  *  See Duktape AUTHORS.rst and LICENSE.txt for copyright and
  *  licensing information.
@@ -10924,17 +10924,17 @@
 235,1,64,170,187,81,119,34,66,146,36,104,137,194,70,46,142,68,165,19,236,1,
 64,174,187,81,95,37,134,204,23,225,35,23,71,34,82,137,246,128,160,89,93,
 168,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,81,71,105,20,
-19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,0,0,0,0,93,105,160,91,
-60,149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,168,
-110,20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,115,
-36,14,100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,145,
-139,163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,166,
-28,1,204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,145,
-92,203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,41,
-100,73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,177,
-69,49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,99,
-68,152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,9,
-49,39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,
+19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,0,0,0,32,93,105,160,
+91,60,149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,
+168,110,20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,
+115,36,14,100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,
+145,139,163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,
+166,28,1,204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,
+145,92,203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,
+41,100,73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,
+177,69,49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,
+99,68,152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,
+9,49,39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,
 98,79,133,91,129,61,109,74,41,124,60,137,62,33,179,216,166,216,193,18,36,
 249,68,54,123,20,218,216,137,18,124,67,103,163,173,77,177,162,100,73,242,
 136,108,244,117,169,181,193,18,36,248,134,207,79,74,155,99,132,200,147,229,
@@ -11108,91 +11108,91 @@
 64,170,187,81,119,34,66,146,36,104,137,194,70,46,142,68,165,19,236,1,64,
 174,187,81,95,37,134,204,23,225,35,23,71,34,82,137,246,128,160,89,93,168,
 167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,81,71,105,20,19,
-177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,32,105,221,0,0,0,0,0,91,60,
-149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,168,110,
-20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,115,36,14,
-100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,145,139,
-163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,166,28,1,
-204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,145,92,
-203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,41,100,
-73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,177,69,
-49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,99,68,
-152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,9,49,
-39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,98,
-79,133,91,129,61,109,74,41,124,60,137,62,33,179,216,166,216,193,18,36,249,
-68,54,123,20,218,216,137,18,124,67,103,163,173,77,177,162,100,73,242,136,
-108,244,117,169,181,193,18,36,248,134,207,79,74,155,99,132,200,147,229,16,
-217,233,233,83,107,162,164,73,240,171,112,39,167,165,77,175,10,145,39,194,
-173,192,158,182,165,54,191,153,51,72,71,161,196,201,45,167,146,59,68,89,24,
-70,206,1,255,128,0,0,0,0,0,1,153,51,104,71,161,196,201,45,167,146,59,68,89,
-24,70,206,1,255,128,0,0,0,0,0,1,153,51,136,71,161,196,201,45,167,146,59,68,
-89,24,70,206,1,255,128,0,0,0,0,0,1,153,51,168,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,0,0,0,0,0,0,0,1,153,51,200,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,0,0,0,0,0,0,0,1,153,51,232,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,8,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,40,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,72,71,161,196,201,45,167,146,59,
-68,89,24,70,206,2,1,0,0,0,0,0,0,1,135,52,102,32,76,72,1,246,136,235,103,
-177,69,1,17,32,7,196,54,123,20,82,88,200,144,3,237,17,214,207,71,91,171,37,
-20,65,145,32,7,218,35,173,158,142,183,66,74,41,16,92,72,1,241,13,158,142,
-183,86,74,41,48,92,72,1,241,13,158,142,183,66,74,41,80,100,72,1,246,136,
-235,103,167,165,213,146,138,40,200,144,3,237,17,214,207,79,75,161,37,20,
-138,46,36,0,248,134,207,79,75,171,37,20,154,46,36,0,248,134,207,79,75,161,
-37,20,170,46,36,0,248,85,184,19,234,201,69,24,92,72,1,240,171,112,39,208,
-146,138,70,25,18,0,124,27,168,21,147,171,37,20,113,145,32,7,193,186,129,89,
-58,18,81,72,226,162,64,15,180,71,91,62,172,148,90,0,168,144,3,237,17,214,
-207,161,37,22,144,38,36,0,248,134,207,171,37,22,160,38,36,0,248,134,207,
-161,37,22,176,42,209,68,201,218,35,173,158,197,54,4,218,40,153,56,134,207,
-98,155,75,27,104,162,100,237,17,214,207,71,91,171,37,54,65,182,138,38,78,
-209,29,108,244,117,186,18,83,104,131,45,20,76,156,67,103,163,173,213,146,
-155,76,25,104,162,100,226,27,61,29,110,132,148,218,160,219,69,19,39,104,
-142,182,122,122,93,89,41,178,141,180,81,50,118,136,235,103,167,165,208,146,
-155,69,25,104,162,100,226,27,61,61,46,172,148,218,104,203,69,19,39,16,217,
-233,233,116,36,166,213,70,90,40,153,56,85,184,19,234,201,77,152,101,162,
-137,147,133,91,129,62,132,148,218,48,219,69,19,39,6,234,5,100,234,201,77,
-156,109,162,137,147,131,117,2,178,116,36,166,209,197,218,40,153,59,68,117,
-179,234,201,78,32,11,180,81,50,118,136,235,103,208,146,156,72,21,104,162,
-100,226,27,62,172,148,226,128,171,69,19,39,16,217,244,36,167,22,53,123,102,
-53,155,80,2,21,11,94,201,128,196,133,0,185,80,32,56,156,199,130,36,160,72,
-16,78,126,54,48,5,146,208,34,82,72,1,109,20,76,155,120,28,34,1,225,32,32,2,
-223,133,69,138,43,180,132,234,219,163,161,1,0,9,174,198,238,213,84,88,31,
-86,221,40,7,252,197,200,95,223,71,61,225,122,183,27,72,144,15,253,197,81,
-217,74,224,191,131,117,110,54,142,129,32,31,237,229,189,138,147,114,135,2,
-235,209,1,0,36,135,237,81,16,180,96,63,101,8,207,71,107,74,1,255,53,4,243,
-51,249,222,104,94,202,17,158,148,3,255,106,9,230,103,243,188,210,159,129,
-228,176,192,185,127,46,155,185,41,197,13,55,38,3,127,255,20,138,160,192,25,
-106,8,8,1,58,90,130,64,128,146,27,168,37,8,9,129,186,130,96,160,152,27,165,
-171,64,32,131,25,234,10,64,65,17,11,212,19,133,18,243,167,165,163,32,24,
-157,45,65,64,6,75,191,80,80,66,149,110,116,117,5,8,41,240,247,79,72,188,8,
-134,81,122,84,1,173,198,212,20,48,139,113,180,181,5,36,42,220,109,29,13,65,
-74,6,192,95,76,188,6,196,55,78,188,6,247,91,86,136,26,32,104,220,205,72,1,
-98,234,52,122,130,136,18,72,51,117,68,3,146,27,168,40,161,37,8,207,80,81,
-129,204,13,212,20,112,179,141,26,45,65,75,112,20,43,193,25,19,66,128,153,
-78,40,105,144,92,104,152,131,124,27,253,128,0,10,116,3,68,146,163,9,128,0,
-10,102,3,138,145,137,27,60,0,0,82,129,7,2,4,16,7,2,70,143,178,203,164,237,
-35,14,25,10,134,147,143,139,158,72,207,28,54,77,47,109,13,55,113,120,96,
-196,159,29,102,241,241,115,201,25,227,131,36,133,20,62,110,143,17,16,113,
-137,62,62,46,155,167,135,147,142,47,44,151,79,221,64,98,37,194,94,100,108,
-144,21,147,140,73,168,228,19,17,124,73,82,54,124,37,230,70,201,14,108,185,
-36,155,14,243,243,83,212,69,131,132,4,12,137,114,168,37,166,145,7,10,4,28,
-200,14,12,40,56,153,56,178,52,211,60,124,0,0,85,0,160,226,100,227,138,89,
-18,113,240,0,1,86,1,131,66,148,145,143,128,0,10,144,93,134,0,0,43,80,17,42,
-4,17,136,49,73,19,49,134,16,143,67,137,146,91,79,36,118,136,178,48,141,156,
-3,255,0,0,0,0,0,0,3,49,135,16,143,67,137,146,91,79,36,118,136,178,48,141,
-156,3,255,0,0,0,0,0,0,5,20,5,173,194,227,214,4,55,0,0,21,196,7,122,192,134,
-241,197,192,0,5,121,25,140,64,132,122,28,76,146,218,121,35,180,69,145,132,
-108,224,31,248,0,0,0,0,0,0,25,140,72,132,122,28,76,146,218,121,35,180,69,
-145,132,108,224,32,0,0,0,0,0,0,0,25,140,80,132,122,28,76,146,218,121,35,
-180,69,145,132,108,224,32,0,0,0,0,0,0,0,25,140,88,132,122,28,76,146,218,
-121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,96,132,122,28,76,146,
-218,121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,104,132,122,28,
-76,146,218,121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,112,132,
-122,28,76,146,218,121,35,180,69,145,132,108,224,32,16,0,0,0,0,0,0,16,113,
-225,0,48,156,209,2,122,244,5,34,92,35,68,225,161,166,218,16,33,18,224,104,
-82,146,59,50,5,7,19,39,22,70,154,103,215,32,28,78,99,193,18,80,70,131,165,
-1,205,34,8,35,68,225,161,166,239,255,4,12,70,137,195,39,248,73,7,78,3,154,
-102,16,70,137,195,67,77,223,248,1,74,9,129,125,255,130,9,65,154,232,147,
-161,115,59,255,5,64,195,32,156,50,126,197,14,2,3,107,173,213,0,
+177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,32,105,221,32,0,0,0,0,91,
+60,149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,168,
+110,20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,115,
+36,14,100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,145,
+139,163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,166,
+28,1,204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,145,
+92,203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,41,
+100,73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,177,
+69,49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,99,
+68,152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,9,
+49,39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,
+98,79,133,91,129,61,109,74,41,124,60,137,62,33,179,216,166,216,193,18,36,
+249,68,54,123,20,218,216,137,18,124,67,103,163,173,77,177,162,100,73,242,
+136,108,244,117,169,181,193,18,36,248,134,207,79,74,155,99,132,200,147,229,
+16,217,233,233,83,107,162,164,73,240,171,112,39,167,165,77,175,10,145,39,
+194,173,192,158,182,165,54,191,153,51,72,71,161,196,201,45,167,146,59,68,
+89,24,70,206,1,255,128,0,0,0,0,0,1,153,51,104,71,161,196,201,45,167,146,59,
+68,89,24,70,206,1,255,128,0,0,0,0,0,1,153,51,136,71,161,196,201,45,167,146,
+59,68,89,24,70,206,1,255,128,0,0,0,0,0,1,153,51,168,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,0,0,0,0,0,0,0,1,153,51,200,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,0,0,0,0,0,0,0,1,153,51,232,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,8,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,40,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,0,128,0,0,0,0,0,1,153,52,72,71,161,196,201,45,167,
+146,59,68,89,24,70,206,2,1,0,0,0,0,0,0,1,135,52,102,32,76,72,1,246,136,235,
+103,177,69,1,17,32,7,196,54,123,20,82,88,200,144,3,237,17,214,207,71,91,
+171,37,20,65,145,32,7,218,35,173,158,142,183,66,74,41,16,92,72,1,241,13,
+158,142,183,86,74,41,48,92,72,1,241,13,158,142,183,66,74,41,80,100,72,1,
+246,136,235,103,167,165,213,146,138,40,200,144,3,237,17,214,207,79,75,161,
+37,20,138,46,36,0,248,134,207,79,75,171,37,20,154,46,36,0,248,134,207,79,
+75,161,37,20,170,46,36,0,248,85,184,19,234,201,69,24,92,72,1,240,171,112,
+39,208,146,138,70,25,18,0,124,27,168,21,147,171,37,20,113,145,32,7,193,186,
+129,89,58,18,81,72,226,162,64,15,180,71,91,62,172,148,90,0,168,144,3,237,
+17,214,207,161,37,22,144,38,36,0,248,134,207,171,37,22,160,38,36,0,248,134,
+207,161,37,22,176,42,209,68,201,218,35,173,158,197,54,4,218,40,153,56,134,
+207,98,155,75,27,104,162,100,237,17,214,207,71,91,171,37,54,65,182,138,38,
+78,209,29,108,244,117,186,18,83,104,131,45,20,76,156,67,103,163,173,213,
+146,155,76,25,104,162,100,226,27,61,29,110,132,148,218,160,219,69,19,39,
+104,142,182,122,122,93,89,41,178,141,180,81,50,118,136,235,103,167,165,208,
+146,155,69,25,104,162,100,226,27,61,61,46,172,148,218,104,203,69,19,39,16,
+217,233,233,116,36,166,213,70,90,40,153,56,85,184,19,234,201,77,152,101,
+162,137,147,133,91,129,62,132,148,218,48,219,69,19,39,6,234,5,100,234,201,
+77,156,109,162,137,147,131,117,2,178,116,36,166,209,197,218,40,153,59,68,
+117,179,234,201,78,32,11,180,81,50,118,136,235,103,208,146,156,72,21,104,
+162,100,226,27,62,172,148,226,128,171,69,19,39,16,217,244,36,167,22,53,123,
+102,53,155,80,2,21,11,94,201,128,196,133,0,185,80,32,56,156,199,130,36,160,
+72,16,78,126,54,48,5,146,208,34,82,72,1,109,20,76,155,120,28,34,1,225,32,
+32,2,223,133,69,138,43,180,132,234,219,163,161,1,0,9,174,198,238,213,84,88,
+31,86,221,40,7,252,197,200,95,223,71,61,225,122,183,27,72,144,15,253,197,
+81,217,74,224,191,131,117,110,54,142,129,32,31,237,229,189,138,147,114,135,
+2,235,209,1,0,36,135,237,81,16,180,96,63,101,8,207,71,107,74,1,255,53,4,
+243,51,249,222,104,94,202,17,158,148,3,255,106,9,230,103,243,188,210,159,
+129,228,176,192,185,127,46,155,185,41,197,13,55,38,3,127,255,20,138,160,
+192,25,106,8,8,1,58,90,130,64,128,146,27,168,37,8,9,129,186,130,96,160,152,
+27,165,171,64,32,131,25,234,10,64,65,17,11,212,19,133,18,243,167,165,163,
+32,24,157,45,65,64,6,75,191,80,80,66,149,110,116,117,5,8,41,240,247,79,72,
+188,8,134,81,122,84,1,173,198,212,20,48,139,113,180,181,5,36,42,220,109,29,
+13,65,74,6,192,95,76,188,6,196,55,78,188,6,247,91,86,136,26,32,104,220,205,
+72,1,98,234,52,122,130,136,18,72,51,117,68,3,146,27,168,40,161,37,8,207,80,
+81,129,204,13,212,20,112,179,141,26,45,65,75,112,20,43,193,25,19,66,128,
+153,78,40,105,144,92,104,152,131,124,27,253,128,0,10,116,3,68,146,163,9,
+128,0,10,102,3,138,145,137,27,60,0,0,82,129,7,2,4,16,7,2,70,143,178,203,
+164,237,35,14,25,10,134,147,143,139,158,72,207,28,54,77,47,109,13,55,113,
+120,96,196,159,29,102,241,241,115,201,25,227,131,36,133,20,62,110,143,17,
+16,113,137,62,62,46,155,167,135,147,142,47,44,151,79,221,64,98,37,194,94,
+100,108,144,21,147,140,73,168,228,19,17,124,73,82,54,124,37,230,70,201,14,
+108,185,36,155,14,243,243,83,212,69,131,132,4,12,137,114,168,37,166,145,7,
+10,4,28,200,14,12,40,56,153,56,178,52,211,60,124,0,0,85,0,160,226,100,227,
+138,89,18,113,240,0,1,86,1,131,66,148,145,143,128,0,10,144,93,134,0,0,43,
+80,17,42,4,17,136,49,73,19,49,134,16,143,67,137,146,91,79,36,118,136,178,
+48,141,156,3,255,0,0,0,0,0,0,3,49,135,16,143,67,137,146,91,79,36,118,136,
+178,48,141,156,3,255,0,0,0,0,0,0,5,20,5,173,194,227,214,4,55,0,0,21,196,7,
+122,192,134,241,197,192,0,5,121,25,140,64,132,122,28,76,146,218,121,35,180,
+69,145,132,108,224,31,248,0,0,0,0,0,0,25,140,72,132,122,28,76,146,218,121,
+35,180,69,145,132,108,224,32,0,0,0,0,0,0,0,25,140,80,132,122,28,76,146,218,
+121,35,180,69,145,132,108,224,32,0,0,0,0,0,0,0,25,140,88,132,122,28,76,146,
+218,121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,96,132,122,28,76,
+146,218,121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,104,132,122,
+28,76,146,218,121,35,180,69,145,132,108,224,32,8,0,0,0,0,0,0,25,140,112,
+132,122,28,76,146,218,121,35,180,69,145,132,108,224,32,16,0,0,0,0,0,0,16,
+113,225,0,48,156,209,2,122,244,5,34,92,35,68,225,161,166,218,16,33,18,224,
+104,82,146,59,50,5,7,19,39,22,70,154,103,215,32,28,78,99,193,18,80,70,131,
+165,1,205,34,8,35,68,225,161,166,239,255,4,12,70,137,195,39,248,73,7,78,3,
+154,102,16,70,137,195,67,77,223,248,1,74,9,129,125,255,130,9,65,154,232,
+147,161,115,59,255,5,64,195,32,156,50,126,197,14,2,3,107,173,213,0,
 };
 #elif defined(DUK_USE_DOUBLE_ME)
 DUK_INTERNAL const duk_uint8_t duk_builtins_data[3972] = {
@@ -11292,17 +11292,17 @@
 235,1,64,170,187,81,119,34,66,146,36,104,137,194,70,46,142,68,165,19,236,1,
 64,174,187,81,95,37,134,204,23,225,35,23,71,34,82,137,246,128,160,89,93,
 168,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,81,71,105,20,
-19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,93,105,160,0,0,0,0,91,
-60,149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,168,
-110,20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,115,
-36,14,100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,145,
-139,163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,166,
-28,1,204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,145,
-92,203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,41,
-100,73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,177,
-69,49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,99,
-68,152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,9,
-49,39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,
+19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,32,93,105,160,0,0,0,0,
+91,60,149,195,200,194,8,134,149,216,114,1,128,83,192,144,8,194,195,16,12,
+168,110,20,120,12,141,22,16,120,12,100,22,12,120,28,78,99,192,41,224,136,
+115,36,14,100,197,213,245,193,48,189,112,40,2,237,96,175,131,117,2,178,112,
+145,139,163,145,131,114,70,46,142,218,27,182,72,197,209,219,56,26,53,161,
+166,28,1,204,178,10,14,38,78,44,141,52,207,31,0,0,21,64,129,100,180,8,148,
+145,92,203,176,160,226,100,226,200,211,76,241,240,0,1,84,2,131,137,147,142,
+41,100,73,199,192,0,5,88,6,13,10,82,70,62,0,0,42,66,88,115,18,124,67,103,
+177,69,49,130,12,73,242,136,108,246,40,165,177,6,36,248,134,207,71,90,138,
+99,68,152,147,229,16,217,232,235,81,75,130,12,73,241,13,158,158,149,20,199,
+9,49,39,202,33,179,211,210,162,151,69,24,147,225,86,224,79,79,74,138,94,20,
 98,79,133,91,129,61,109,74,41,124,60,137,62,33,179,216,166,216,193,18,36,
 249,68,54,123,20,218,216,137,18,124,67,103,163,173,77,177,162,100,73,242,
 136,108,244,117,169,181,193,18,36,248,134,207,79,74,155,99,132,200,147,229,
@@ -32236,7 +32236,7 @@
 	duk_dup_1(thr);
 	duk_push_string(thr, "){");
 	duk_dup_0(thr);
-	duk_push_string(thr, "}");
+	duk_push_string(thr, "\n}");  /* Newline is important to handle trailing // comment. */
 	duk_concat(thr, 5);
 
 	/* [ body formals source ] */
@@ -62564,9 +62564,10 @@
 	 *    - Disable StepOut processing for the activation unwind because
 	 *      we reuse the activation, see:
 	 *      https://github.com/svaarala/duktape/issues/1684.
-	 *    - Disable line change pause flag permanently (if set) because
-	 *      it would no longer be relevant, see:
-	 *      https://github.com/svaarala/duktape/issues/1726.
+	 *    - Disable line change pause flag permanently if act == dbg_pause_act
+	 *      (if set) because it would no longer be relevant, see:
+	 *      https://github.com/svaarala/duktape/issues/1726,
+	 *      https://github.com/svaarala/duktape/issues/1786.
 	 *    - Check for function entry (e.g. StepInto) pause flag here, because
 	 *      the executor pause check won't trigger due to shared activation, see:
 	 *      https://github.com/svaarala/duktape/issues/1726.
@@ -62587,9 +62588,12 @@
 	DUK_ASSERT(thr->callstack_top > 0);
 	DUK_ASSERT(thr->callstack_curr != NULL);
 #if defined(DUK_USE_DEBUGGER_SUPPORT)
+	if (act == thr->heap->dbg_pause_act) {
+		thr->heap->dbg_pause_flags &= ~DUK_PAUSE_FLAG_LINE_CHANGE;
+	}
+
 	prev_pause_act = thr->heap->dbg_pause_act;
 	thr->heap->dbg_pause_act = NULL;
-	thr->heap->dbg_pause_flags &= ~DUK_PAUSE_FLAG_LINE_CHANGE;
 	if (thr->heap->dbg_pause_flags & DUK_PAUSE_FLAG_FUNC_ENTRY) {
 		DUK_D(DUK_DPRINT("PAUSE TRIGGERED by function entry (tailcall)"));
 		duk_debug_set_paused(thr->heap);
@@ -73596,18 +73600,38 @@
 
 	resumer = thr->resumer;
 
-	/* Share yield longjmp handler. */
+	/* Share yield longjmp handler.
+	 *
+	 * This sequence of steps is a bit fragile (see GH-1845):
+	 * - We need the return value from 'thr' (resumed thread) value stack.
+	 *   The termination unwinds its value stack, losing the value.
+	 * - We need a refcounted reference for 'thr', which may only exist
+	 *   in the caller value stack.  We can't unwind or reconfigure the
+	 *   caller's value stack without potentially freeing 'thr'.
+	 *
+	 * Current approach is to capture the 'thr' return value and store
+	 * a reference to 'thr' in the caller value stack temporarily.  This
+	 * keeps 'thr' reachable until final yield/return handling which
+	 * removes the references atomatically.
+	 */
+
 	DUK_ASSERT(thr->valstack_top - 1 >= thr->valstack_bottom);
-	duk_hthread_activation_unwind_norz(resumer);
-	duk__handle_yield(thr, resumer, thr->valstack_top - 1);
+	duk_hthread_activation_unwind_norz(resumer);  /* May remove last reference to 'thr', but is NORZ. */
+	duk_push_tval(resumer, thr->valstack_top - 1);  /* Capture return value, side effect free. */
+	duk_push_hthread(resumer, thr);  /* Make 'thr' reachable again, before side effects. */
 
-	duk_hthread_terminate(thr);  /* updates thread state, minimizes its allocations */
-	DUK_ASSERT(thr->state == DUK_HTHREAD_STATE_TERMINATED);
-
+	duk_hthread_terminate(thr);  /* Updates thread state, minimizes its allocations. */
 	thr->resumer = NULL;
 	DUK_HTHREAD_DECREF(thr, resumer);
+	DUK_ASSERT(thr->state == DUK_HTHREAD_STATE_TERMINATED);
+
 	resumer->state = DUK_HTHREAD_STATE_RUNNING;
 	DUK_HEAP_SWITCH_THREAD(thr->heap, resumer);
+
+	DUK_ASSERT(resumer->valstack_top - 2 >= resumer->valstack_bottom);
+	duk__handle_yield(thr, resumer, resumer->valstack_top - 2);
+	thr = NULL;  /* 'thr' invalidated by call */
+
 #if 0
 	thr = resumer;  /* not needed */
 #endif
diff --git a/duktape/duktape.h b/duktape/duktape.h
index 848b1ee..bf330a1 100644
--- a/duktape/duktape.h
+++ b/duktape/duktape.h
@@ -1,13 +1,13 @@
 /*
- *  Duktape public API for Duktape 2.2.0.
+ *  Duktape public API for Duktape 2.2.1.
  *
  *  See the API reference for documentation on call semantics.  The exposed,
  *  supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
  *  comments.  Other parts of the header are Duktape internal and related to
  *  e.g. platform/compiler/feature detection.
  *
- *  Git commit a459cf3c9bd1779fc01b435d69302b742675a08f (v2.2.0).
- *  Git branch master.
+ *  Git commit 25420e773c5fbc50d5b46bf487fc45717e35b94f (v2.2.1).
+ *  Git branch v2.2-maintenance.
  *
  *  See Duktape AUTHORS.rst and LICENSE.txt for copyright and
  *  licensing information.
@@ -154,16 +154,16 @@
  * development snapshots have 99 for patch level (e.g. 0.10.99 would be a
  * development version after 0.10.0 but before the next official release).
  */
-#define DUK_VERSION                       20200L
+#define DUK_VERSION                       20201L
 
 /* Git commit, describe, and branch for Duktape build.  Useful for
  * non-official snapshot builds so that application code can easily log
  * which Duktape snapshot was used.  Not available in the Ecmascript
  * environment.
  */
-#define DUK_GIT_COMMIT                    "a459cf3c9bd1779fc01b435d69302b742675a08f"
-#define DUK_GIT_DESCRIBE                  "v2.2.0"
-#define DUK_GIT_BRANCH                    "master"
+#define DUK_GIT_COMMIT                    "25420e773c5fbc50d5b46bf487fc45717e35b94f"
+#define DUK_GIT_DESCRIBE                  "v2.2.1"
+#define DUK_GIT_BRANCH                    "v2.2-maintenance"
 
 /* External duk_config.h provides platform/compiler/OS dependent
  * typedefs and macros, and DUK_USE_xxx config options so that