Refactor as required (scope, naming).

This commit is contained in:
Ondřej Španěl 2017-02-20 09:39:10 +01:00
parent 452e2d37ed
commit 8aff2332e5

View File

@ -1308,6 +1308,10 @@ function parse($TEXT, options) {
}); });
}); });
var create_accessor = embed_tokens(function() {
return function_(AST_Accessor);
});
var object_ = embed_tokens(function() { var object_ = embed_tokens(function() {
expect("{"); expect("{");
var first = true, a = []; var first = true, a = [];
@ -1320,14 +1324,11 @@ function parse($TEXT, options) {
var type = start.type; var type = start.type;
var name = as_property_name(); var name = as_property_name();
if (type == "name" && !is("punc", ":")) { if (type == "name" && !is("punc", ":")) {
var createAccessor = embed_tokens(function() {
return function_(AST_Accessor);
});
if (name == "get") { if (name == "get") {
a.push(new AST_ObjectGetter({ a.push(new AST_ObjectGetter({
start : start, start : start,
key : as_atom_node(), key : as_atom_node(),
value : createAccessor(), value : create_accessor(),
end : prev() end : prev()
})); }));
continue; continue;
@ -1336,7 +1337,7 @@ function parse($TEXT, options) {
a.push(new AST_ObjectSetter({ a.push(new AST_ObjectSetter({
start : start, start : start,
key : as_atom_node(), key : as_atom_node(),
value : createAccessor(), value : create_accessor(),
end : prev() end : prev()
})); }));
continue; continue;