Consider the following YAML file:
{
funcype: &TEST !!js/function "function (){ }",
my_other_func: *TEST
}
This gets loaded as:
{ funcype: [Function], my_other_func: 'function (){ }' }
Instead of the expected object
{ funcype: [Function], my_other_func: [Function] }
My initial guess at why, given a very cursory review of the code, is because loader.js saves the anchor node as the state.result text instead of the constructed object.
For example, consider this snipppet at line 1339 in composeNode
if (null !== state.anchor) {
state.anchorMap[state.anchor] = state.result;
}
The above line is prior to the code that constructs the actual anchored node:
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
state.result = type.construct(state.result);
state.tag = type.tag;
break;
}
To address this would require constructing the custom type first before inserting into anchorMap. Due to the recursive nature of the parser and that this would need to be addresses in several areas of the code this is something I do not feel very comfortable coding as a pull request. Best reviewed and resolved by the maintainers.
Consider the following YAML file:
This gets loaded as:
{ funcype: [Function], my_other_func: 'function (){ }' }Instead of the expected object
{ funcype: [Function], my_other_func: [Function] }My initial guess at why, given a very cursory review of the code, is because loader.js saves the anchor node as the state.result text instead of the constructed object.
For example, consider this snipppet at line 1339 in composeNode
The above line is prior to the code that constructs the actual anchored node:
To address this would require constructing the custom type first before inserting into anchorMap. Due to the recursive nature of the parser and that this would need to be addresses in several areas of the code this is something I do not feel very comfortable coding as a pull request. Best reviewed and resolved by the maintainers.