MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

www/js/_hyperscript.js:4146–4182  ·  view source on GitHub ↗
(parser, root)

Source from the content-addressed store, hash-verified

4144 this._isComputed = urRoot.type === "computedStyleRef";
4145 }
4146 static parse(parser, root) {
4147 if (!parser.matchToken("of")) return;
4148 var newRoot = parser.requireElement("unaryExpression");
4149 var childOfUrRoot = null;
4150 var urRoot = root;
4151 while (urRoot.root) {
4152 childOfUrRoot = urRoot;
4153 urRoot = urRoot.root;
4154 }
4155 var validOfRoots = ["symbol", "attributeRef", "styleRef", "computedStyleRef"];
4156 if (!validOfRoots.includes(urRoot.type)) {
4157 parser.raiseError("Cannot take a property of a non-symbol: " + urRoot.type);
4158 }
4159 var attribute = urRoot.type === "attributeRef";
4160 var style = urRoot.type === "styleRef" || urRoot.type === "computedStyleRef";
4161 var attributeElt = attribute || style ? urRoot : null;
4162 var prop = urRoot.name;
4163 var propertyAccess = new _OfExpression(
4164 urRoot.token,
4165 // can be undefined for attributeRef
4166 newRoot,
4167 attributeElt,
4168 root,
4169 { root: newRoot },
4170 urRoot
4171 );
4172 if (urRoot.type === "attributeRef") {
4173 propertyAccess.attribute = urRoot;
4174 }
4175 if (childOfUrRoot) {
4176 childOfUrRoot.root = propertyAccess;
4177 childOfUrRoot.args = { root: propertyAccess };
4178 } else {
4179 root = propertyAccess;
4180 }
4181 return parser.parseElement("indirectExpression", root);
4182 }
4183 resolve(context, { root: rootVal }) {
4184 if (this._isAttribute) {
4185 return context.meta.runtime.resolveAttribute(rootVal, this._prop);

Callers

nothing calls this directly

Calls 4

matchTokenMethod · 0.45
requireElementMethod · 0.45
raiseErrorMethod · 0.45
parseElementMethod · 0.45

Tested by

no test coverage detected