facebookarchive/prepack

Comment update in __abstract

Open

#1950 aperta il 12 mag 2018

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)JavaScript (520 fork)batch import
enhancementhelp wantedquestion

Metriche repository

Star
 (14.268 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor