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

bug(#3481): builds FQN via XSL #3808

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

maxonfjvipon
Copy link
Member

@maxonfjvipon maxonfjvipon commented Jan 12, 2025

Ref: #3481

In this PR I introduced XSL transformation that finds closest objects references and builds FQN, almost the same as add-refs.xsl does, but it inserts explicit objects.

Consider the next EO from builds-fnq.yaml pack:

# No comments.
[x y] > first
  stdout x > std
  [std] > second
    std x > inner
    [] > third
      5 > x
      x.plus y > sum
      std qwe > closest
    [] > fourth
      "some" > inner
      ^.inner > outer
      inner > self
foo > bar

# Foo.
[] > foo

The transformation converts it to the next EO:

[x y] > first
  stdout $.x > std
  [std] > second
    $.std ^.x > inner
    [] > third
      5 > x
      $.x.plus ^.^.y > sum
      ^.std qwe > closest
    [] > fourth
      "some" > inner
      ^.inner > outer
      $.inner > self
foo > bar

# Foo.
[] > foo

As you may see - it adds necessary $ or ^. objects.

When it's used in TrShaking - we're not going to need add-refs.xsl (which is used a several times) anymore because we're going to have FQN that are not needed be be resolved.

UPD:
If future, if the transformation is going to be heavy, it can be easily simplified: instead of inserting objects directly - we can attach some numeric attribute to target object. If attribute value is 0 - it means we should use $, if it's > 0 then we should insert some ^. objects. How much - attribute value shows

@maxonfjvipon
Copy link
Member Author

@yegor256 please check

Copy link
Member

@yegor256 yegor256 left a comment

Choose a reason for hiding this comment

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

@maxonfjvipon looks cool!

@yegor256 yegor256 added this pull request to the merge queue Jan 13, 2025
Merged via the queue into objectionary:master with commit 19e280f Jan 13, 2025
21 checks passed
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