mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 03:08:55 -06:00
Catch for when rules are undefined
This commit is contained in:
@@ -1115,8 +1115,9 @@ class ParseState {
|
|||||||
} else {
|
} else {
|
||||||
let trees: Fun[] = []
|
let trees: Fun[] = []
|
||||||
|
|
||||||
let rules = forest[fid]
|
let rules = forest[fid] // could be undefined
|
||||||
rules.forEach((rule: Rule): void => {
|
for (let j in rules) {
|
||||||
|
let rule: Rule = rules[j]
|
||||||
if (rule.id == 'Const') {
|
if (rule.id == 'Const') {
|
||||||
trees.push((rule as Const).lit)
|
trees.push((rule as Const).lit)
|
||||||
} else {
|
} else {
|
||||||
@@ -1149,7 +1150,7 @@ class ParseState {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
return trees
|
return trees
|
||||||
}
|
}
|
||||||
@@ -1495,9 +1496,9 @@ class ActiveItem {
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
/* from Remedial JavaScript by Douglas Crockford, http://javascript.crockford.com/remedial.html */
|
/* from Remedial JavaScript by Douglas Crockford, http://javascript.crockford.com/remedial.html */
|
||||||
function isString(a: any): boolean {
|
// function isString(a: any): boolean {
|
||||||
return typeof a == 'string' || a instanceof String
|
// return typeof a == 'string' || a instanceof String
|
||||||
}
|
// }
|
||||||
// function isArray(a: any): boolean {
|
// function isArray(a: any): boolean {
|
||||||
// return a && typeof a == 'object' && a.constructor == Array
|
// return a && typeof a == 'object' && a.constructor == Array
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user