nadesiko3 3.2.46 → 3.2.47
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/package.json +1 -1
- package/release/_hash.txt +24 -24
- package/release/_script-tags.txt +13 -13
- package/release/command.json +1 -1
- package/release/command.json.js +1 -1
- package/release/command_cnako3.json +1 -1
- package/release/command_list.json +1 -1
- package/release/editor.js +1 -1
- package/release/nako_gen_async.js +1 -1
- package/release/stats.json +1 -1
- package/release/version.js +1 -1
- package/release/wnako3.js +1 -1
- package/release/wnako3webworker.js +1 -1
- package/src/nako_gen.js +16 -4
- package/src/nako_global.js +2 -1
- package/src/nako_version.js +2 -2
package/src/nako_gen.js
CHANGED
|
@@ -45,9 +45,18 @@ class NakoGen {
|
|
|
45
45
|
canAsync = (ua.indexOf('MSIE') === -1)
|
|
46
46
|
}
|
|
47
47
|
if (canAsync) {
|
|
48
|
-
js =
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
js = `
|
|
49
|
+
// <nadesiko3::gen::async>
|
|
50
|
+
(async () => { // async::main
|
|
51
|
+
${js}
|
|
52
|
+
}).call(this).catch(err => {
|
|
53
|
+
if (!(err instanceof this.NakoRuntimeError)) {
|
|
54
|
+
err = new this.NakoRuntimeError(err, this.__varslist[0].line);
|
|
55
|
+
}
|
|
56
|
+
this.logger.error(err);
|
|
57
|
+
throw err;
|
|
58
|
+
}); // async::main
|
|
59
|
+
// <nadesiko3::gen::async>\n`
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
|
|
@@ -1218,7 +1227,7 @@ try {
|
|
|
1218
1227
|
|
|
1219
1228
|
// 関数呼び出しで、引数の末尾にthisを追加する-システム情報を参照するため
|
|
1220
1229
|
args.push('__self')
|
|
1221
|
-
|
|
1230
|
+
let funcDef = 'function'
|
|
1222
1231
|
let funcBegin = ''
|
|
1223
1232
|
let funcEnd = ''
|
|
1224
1233
|
// setter?
|
|
@@ -1292,6 +1301,7 @@ try {
|
|
|
1292
1301
|
|
|
1293
1302
|
let funcCall = `${res.js}(${argsCode})`
|
|
1294
1303
|
if (func.asyncFn) {
|
|
1304
|
+
funcDef = `async ${funcDef}`
|
|
1295
1305
|
funcCall = `await ${funcCall}`
|
|
1296
1306
|
this.numAsyncFn++
|
|
1297
1307
|
}
|
|
@@ -1325,6 +1335,7 @@ try {
|
|
|
1325
1335
|
|
|
1326
1336
|
let code = ''
|
|
1327
1337
|
if (func.return_none) {
|
|
1338
|
+
// 戻り値のない関数の場合
|
|
1328
1339
|
if (funcEnd === '') {
|
|
1329
1340
|
if (funcBegin === '') {
|
|
1330
1341
|
code = `${funcCall};\n`
|
|
@@ -1335,6 +1346,7 @@ try {
|
|
|
1335
1346
|
code = `${funcBegin}try {\n${indent(funcCall, 1)};\n} finally {\n${indent(funcEnd, 1)}}\n`
|
|
1336
1347
|
}
|
|
1337
1348
|
} else {
|
|
1349
|
+
// 戻り値のある関数の場合
|
|
1338
1350
|
let sorePrefex = ''
|
|
1339
1351
|
if (this.speedMode.invalidSore === 0) {
|
|
1340
1352
|
sorePrefex = `${this.varname('それ')} = `
|
package/src/nako_global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const NakoColors = require('./nako_colors')
|
|
2
|
-
|
|
2
|
+
const {NakoRuntimeError} = require('./nako_errors')
|
|
3
3
|
/**
|
|
4
4
|
* コンパイルされたなでしこのプログラムで、グローバル空間のthisが指すオブジェクト
|
|
5
5
|
*/
|
|
@@ -23,6 +23,7 @@ class NakoGlobal {
|
|
|
23
23
|
this.__stack = []
|
|
24
24
|
this.__labels = []
|
|
25
25
|
this.__genMode = gen.genMode
|
|
26
|
+
this.NakoRuntimeError = NakoRuntimeError
|
|
26
27
|
|
|
27
28
|
// PluginSystemとdestroy()から参照するため
|
|
28
29
|
this.__module = { ...compiler.__module } // shallow copy
|