facebookarchive/prepack

Comment update in __abstract

Open

#1,950 opened on May 12, 2018

View on GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (520 forks)batch import
enhancementhelp wantedquestion

Repository metrics

Stars
 (14,268 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I was trying to read the through the test files and needed to look up the __abstract call. I noticed the helpful comment in src/intrinsics/prepack/global.js:61

  // Helper function to model values that are obtained from the environment,
  // and whose concrete values are not known at Prepack-time.
  // __abstract(typeNameOrTemplate, name, options) creates a new abstract value
  // where typeNameOrTemplate can be...
  // - 'string', 'boolean', 'number', 'object', 'function' or
  // - ':string', ':boolean', ':number', ':object', ':function' to indicate that
  //   the abstract value represents a function that only returns values of the specified type, or
  // - an actual object defining known properties.
  // If the abstract value gets somehow embedded in the final heap,
  // it will be referred to by the supplied name in the generated code.

Then I jumped into src/utils.js:54 and see that getTypeFromName supports more types now - empty, void, null, boolean, string, symbol, number, object, array, function, integral

Just making a small low priority issue to update comment if that's the right move. Also available to help update as well.

Contributor guide