nadesiko3 3.3.6 → 3.3.7
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 +8 -8
- package/release/_script-tags.txt +14 -14
- package/release/stats.json +1 -1
- package/release/version.js +1 -1
- package/release/wnako3.js +1 -1
- package/src/nako_parser3.mjs +12 -10
- package/src/nako_version.mjs +2 -2
- package/test/common/variable_scope_test.mjs +13 -0
package/src/nako_parser3.mjs
CHANGED
|
@@ -1028,7 +1028,7 @@ export class NakoParser extends NakoParserBase {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
-
/** @returns {import('./nako3').Ast | null | undefined} */
|
|
1031
|
+
/** @returns {import('./nako3.mjs').Ast | null | undefined} */
|
|
1032
1032
|
yDainyu () {
|
|
1033
1033
|
const map = this.peekSourceMap()
|
|
1034
1034
|
const dainyu = this.get() // 代入
|
|
@@ -1051,14 +1051,15 @@ export class NakoParser extends NakoParserBase {
|
|
|
1051
1051
|
};
|
|
1052
1052
|
}
|
|
1053
1053
|
// 一般的な変数への代入
|
|
1054
|
+
const word2 = this.getVarName(word)
|
|
1054
1055
|
return {
|
|
1055
|
-
type: 'let', name:
|
|
1056
|
+
type: 'let', name: word2,
|
|
1056
1057
|
value: value, josi: '',
|
|
1057
1058
|
...map, end: this.peekSourceMap()
|
|
1058
1059
|
}
|
|
1059
1060
|
}
|
|
1060
1061
|
|
|
1061
|
-
/** @returns {import('./nako3').Ast | null | undefined} */
|
|
1062
|
+
/** @returns {import('./nako3.mjs').Ast | null | undefined} */
|
|
1062
1063
|
ySadameru () {
|
|
1063
1064
|
const map = this.peekSourceMap()
|
|
1064
1065
|
const sadameru = this.get() // 定める
|
|
@@ -1075,7 +1076,7 @@ export class NakoParser extends NakoParserBase {
|
|
|
1075
1076
|
};
|
|
1076
1077
|
}
|
|
1077
1078
|
|
|
1078
|
-
/** @returns {import('./nako3').Ast | null | undefined} */
|
|
1079
|
+
/** @returns {import('./nako3.mjs').Ast | null | undefined} */
|
|
1079
1080
|
yIncDec () {
|
|
1080
1081
|
const map = this.peekSourceMap()
|
|
1081
1082
|
const action = this.get() // (増やす|減らす)
|
|
@@ -1110,7 +1111,7 @@ export class NakoParser extends NakoParserBase {
|
|
|
1110
1111
|
};
|
|
1111
1112
|
}
|
|
1112
1113
|
|
|
1113
|
-
/** @returns {import('./nako3').Ast | null | undefined} */
|
|
1114
|
+
/** @returns {import('./nako3.mjs').Ast | null | undefined} */
|
|
1114
1115
|
yCall () {
|
|
1115
1116
|
if (this.isEOF()) { return null }
|
|
1116
1117
|
|
|
@@ -1933,15 +1934,16 @@ export class NakoParser extends NakoParserBase {
|
|
|
1933
1934
|
// check word name
|
|
1934
1935
|
const f = this.findVar(word.value)
|
|
1935
1936
|
if (!f) { // 変数が見つからない
|
|
1936
|
-
if (this.funcLevel === 0
|
|
1937
|
-
|
|
1938
|
-
word.value
|
|
1937
|
+
if (this.funcLevel === 0) { // global
|
|
1938
|
+
let gname = word.value
|
|
1939
|
+
if (gname.indexOf('__') < 0) { gname = this.modName + '__' + word.value }
|
|
1939
1940
|
this.funclist[gname] = {type: 'var', value: ''}
|
|
1940
|
-
|
|
1941
|
+
word.value = gname
|
|
1942
|
+
} else { // local
|
|
1941
1943
|
this.localvars[word.value] = {type: 'var', value: ''}
|
|
1942
1944
|
}
|
|
1943
1945
|
}
|
|
1944
|
-
if (f && f.scope === 'global') {
|
|
1946
|
+
else if (f && f.scope === 'global') {
|
|
1945
1947
|
word.value = f.name
|
|
1946
1948
|
}
|
|
1947
1949
|
return word
|
package/src/nako_version.mjs
CHANGED