Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Reference Validation #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kunal-mohta
Copy link
Contributor

For #17
There is an issue with this. When I change a seed on a sketch with invalid reference, it says this.phraseBook is undefined

js/core.js Outdated
}
}
phrases.forEach(function(item){
if(item.key === "root"){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not just 'root', all phrases need to be checked.

js/core.js Outdated
phrases.forEach(function(item){
if(item.key === "root"){
item.values.forEach(function(i){
let p = parsePhrase(i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you calling parsePhrase? The source has already been parsed at this point.

js/core.js Outdated
}
});
references.forEach(function(item){
if(!phraseBook[item]){
Copy link
Member

@stebanos stebanos Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, a key can also be a reference to something stored in localMemory, like this:

root:
- {{ dosomething(123) }}

dosomething(num):
- I have to do {{ num }} things.

num is also a key but doesn't refer to a phrase, but in your check it will throw an error.

@kunal-mohta
Copy link
Contributor Author

Wait, I just realized that there is an issue with this. It is giving some error.
Let me check it again.

@kunal-mohta
Copy link
Contributor Author

kunal-mohta commented Feb 24, 2018

This only considers node types key, causing error with all other types.
Still work needs to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants