Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mustachio: Separate out the context stack LUB type calculation #3730

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

srawlins
Copy link
Member

I have a bigger change I've had lying around for generated renderer deduplication, and I've teased out this smaller change.

It's a no-op, and I think I've improved the documentation. I need to write docs for the tool that generates the renderers, but I hope this PR is small enough to understand, and how it is a no-op. Here are some other docs for these renderers.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@srawlins srawlins requested a review from kallentu March 20, 2024 00:32
@@ -116,27 +119,23 @@ Future<Map<_AotCompiler, String>> _deduplicateRenderers(
continue;
}
var firstCompiler = compilers.first;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the codegen is kinda confusing. Why do we use the first compiler's _syntaxTree and _buildData when making the lubCompiler? Also, perhaps move this variable down there, since it's not being used for contextStacksLength anymore

All the other changes seem okay to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, apologies for this not being well documented, I do plan on sending out docs next.

OK, so in this section, we are looking at the "partial compilers" that have been generated for each partial file path. So if one template referred to the "_foo.html" partial with {{ >foo }} and another template also referred to that partial file with {{ >foo }}, then we have to partial compilers, and we're trying to deduplicate them. The reason they are initially separate and why we might not be able to deduplicate is that the variables in scope might be different from one calling template to another.

OK, so the variables might be different, but what is always common between these compilers (for the same partial path) is that they parse out to the same syntax tree (since its the same file on disk). And the _buildData is also just a common grab bag of data.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see! Okay, that makes a lot of sense. Yeah, some extra documentation on that would be great :)

@srawlins srawlins merged commit 9fe35ec into dart-lang:main Mar 20, 2024
9 checks passed
@srawlins srawlins deleted the deduplicate-better-3 branch March 20, 2024 23:05
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Mar 26, 2024
Revisions updated by `dart tools/rev_sdk_deps.dart`.

crypto (https://github.com/dart-lang/crypto/compare/f059196..69d13c9):
  69d13c9  2024-03-21  Kevin Moore  Switch sha512 to use fastpath with wasm (dart-lang/crypto#165)

csslib (https://github.com/dart-lang/csslib/compare/b58e487..4216525):
  4216525  2024-03-21  Devon Carew  prep for publishing 1.0.1 (dart-lang/csslib#197)

dartdoc (https://github.com/dart-lang/dartdoc/compare/7be9e24..79c1675):
  79c16759  2024-03-25  Parker Lougheed  Migrate client code to package:web (dart-lang/dartdoc#3610)
  0b1c7fa4  2024-03-25  dependabot[bot]  Bump actions/cache from 4.0.1 to 4.0.2 (dart-lang/dartdoc#3734)
  9fe35ec5  2024-03-20  Sam Rawlins  mustachio: Separate out the context stack LUB type calculation (dart-lang/dartdoc#3730)

http (https://github.com/dart-lang/http/compare/5dfea72..7949d6f):
  7949d6f  2024-03-25  Brian Quinlan  cupertino_http: upgrade ffigen version (dart-lang/http#1159)
  051482a  2024-03-22  Brian Quinlan  Ready cupertino_http for release with WebSocket support (dart-lang/http#1158)
  988b4d4  2024-03-20  Brian Quinlan  Prepare package:cronet_http 1.2 for release (dart-lang/http#1157)
  69f4eff  2024-03-20  Hossein Yousefi  [cronet_http] Upgrade jni to 0.7.3 (dart-lang/http#1156)
  d8b1a9e  2024-03-19  Brian Quinlan  Release `package:web_socket` 0.1.0 (dart-lang/http#1155)
  cfbc191  2024-03-19  Brian Quinlan  Add a WebSocket implementation to package:cupertino_http (dart-lang/http#1153)

markdown (https://github.com/dart-lang/markdown/compare/9c6b1af..8d07abc):
  8d07abc  2024-03-19  MJ Studio  Link uri encoding, URL-escaping should be left alone inside the destination (dart-lang/markdown#598)

web (https://github.com/dart-lang/web/compare/4af904f..c522718):
  c522718  2024-03-20  Kevin Moore  Update MDN documentation (dart-lang/web#213)
  f80dcab  2024-03-15  Srujan Gaddam  Update pubspec description to be consistent with README (dart-lang/web#210)
  27936c4  2024-03-15  Devon Carew  Generate api docs for getters (dart-lang/web#207)
  2f13cd5  2024-03-12  Devon Carew  fix unresolved dartdoc links (dart-lang/web#200)
  686827a  2024-03-12  Srujan Gaddam  Remove reference to static interop and point to dart.dev page for JS interop (dart-lang/web#206)
  9b7e29d  2024-03-12  Devon Carew  Add a 'sourced from mdn docs' line to the MDN sourced dartdoc (dart-lang/web#198)
  51e594b  2024-03-05  Srujan Gaddam  Fix dictionary constructors to accept supertype members and create an empty object when there are no fields (dart-lang/web#197)

Change-Id: Ic90c6f5a7e7d701746276031a8028cdfe76bc27a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants