react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Revise ComponentValue parsing model

Open NickGerleman opened this issue 1 year ago • 7 comments

Summary: D57089275 introduced a layer to parse component values out of the token stream. I modeled this similar to the tokenizer, as a flat iterator of component values. Because function components can nest a variable number of child component values, this now looks like storing a fully resolved tree of tokens on the heap during parsing.

This diff changes the model, so that CSSSyntaxParser::consumeComponentValue() no longer returns a resolved CSS function value. Instead, users of the parser are expected to provide "visitors" which continue parsing, matched based on component value type pattern matched. Visitors can perform parsing specific to their context, and propagate values up the stack, based on their evaluation of the component value.

Removing the heap allocated list of tokens here also lets this core CSS parsing stack keep constexpr, so I added that back, though we need to keep expression trees for math expressions in uncommon cases, so the layer up probaly won't keep constexpr.

Changelog: [Internal]

Differential Revision: D57206706

NickGerleman avatar May 13 '24 20:05 NickGerleman

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 13 '24 20:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 13 '24 20:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 13 '24 21:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 14 '24 01:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 14 '24 01:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D57206706

facebook-github-bot avatar May 14 '24 01:05 facebook-github-bot

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,542,561 +4
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,912,545 -11
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 44f9371f246932215627a7ea01fbedf5c13e3019 Branch: main

analysis-bot avatar May 14 '24 01:05 analysis-bot

This pull request has been merged in facebook/react-native@258b481ae53d1f735f66d6a01b0a23b0f29030f8.

facebook-github-bot avatar May 16 '24 22:05 facebook-github-bot

This pull request was successfully merged by @NickGerleman in 258b481ae53d1f735f66d6a01b0a23b0f29030f8.

When will my fix make it into a release? | How to file a pick request?

github-actions[bot] avatar May 16 '24 22:05 github-actions[bot]