-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Source section less node #35
Conversation
…ay we develop Truffle
…r subclasses to keep one and return it from the getSourceSection method
When creating a pull request, make sure you designate an assignee to ensure | ||
the request is processed in a timely manner. | ||
|
||
[1]: http://www.oracle.com/technetwork/community/oca-486395.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it should not be part of this pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please rebase.
* To create a node which can associate and change the {@link SourceSection} later at any point | ||
* of time use: | ||
* | ||
* {@codesnippet source.section.mutable} | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not convinced by the usefulness of these codesnippets. I would even say that most GL devs don't read javadocs but are browsing using the IDE where codesnippets dont translate nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, well, the issue would be little less problematic if at least the names would be proper JavaDoc names (like for @link
) that one can click on to navigate to the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, including at least the classname would help a bit to find the snippet within an IDE...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to leave the snippet discussion in #19 - I understand they are source of tension. That said the idea to make them behave like a link or at least include the name of source file is certainly worth exploring.
…e raw Javadoc to actual place in the code with the sample
@jtulach I'd like to hear other people's opinion about this as well, but I think getSourceSection() should stay public. |
|
I see. A real use-case for a tool that we yet have to imagine. If I accept as given that getSourceSection is needed - do we need getEncapsulatingSourceSection() helper method at all? It seems to me like utility method that iterates over chain of nodes. Utility methods don't belong into core API. Each tool write the loop on their own. |
On 2/4/16 11:38 AM, Michael Van De Vanter wrote:
Mick |
I see that FastR overrides getEncapsulatingSourceSetion to delegate to protected method that finds the right node and extracts the section from it. I see four overrides of the method. FastR overrides getSourceSection, but only to throw exceptions in unexpected cases. FastR calls getSourceSection - but mostly only because it passes the section somewhere else (assignSourceSection or constructor of other node). As far as I can tell FastR would benefit from language controlled find/getSourceSection for a node. |
I like the change. +1 I'd leave getSourceSection public for now, but maybe revisit this in another changeset? I think the instrumentation tools could use accessors to access the source section. Tools can access source sections using the EventContext via public API. @chrisseaton @woess please also accept or deny this change @jtulach After that please rebase and merge. |
@@ -146,7 +146,8 @@ public T call() { | |||
|
|||
private static void updateSourceSection(Node oldNode, Node newNode) { | |||
if (newNode.getSourceSection() == null) { | |||
newNode.assignSourceSection(oldNode.getSourceSection()); | |||
throw new IllegalArgumentException("Can't update source: " + oldNode); | |||
// newNode.assignSourceSection(oldNode.getSourceSection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment left in by mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the comment as I expected the exception to be raised at some places, but it wasn't raised yet. But we haven't yet executed all our language tests. Maybe it is wiser to keep it for now.
I'm not sure what the final proposed change is, as @chumer's last comments suggests more changes which may or may not be accepted, so it's hard to accept right now. I currently use I don't mind maintaining the |
OK, this change request will just deprecate Node(SourceSection) constructor and Node#assignSourceSection and Node#cleanSourceSection. Unless there are objections, let's merge tomorrow. |
No objections. Merging. |
Deprecating Node(SourceSection) constructor and Node#assignSourceSection and Node#cleanSourceSection
…/truffle:DebuggerStatement to master DebuggerTags.AlwaysHalt * commit 'bfd6702c14dee81f9a189e6aad166ddce9eea462': AlwaysHalt tag introduced, implementation and test in SL.
According to discussion in #25 it seems that there is a general consensus that SourceSections should be handled by individual languages and the interface in Truffle API simplified to:
The other methods are deprecated while the functionality is kept. Once the deprecated methods are removed, the Node#sourceSection field will be removed as well. RootNode will then get such field to hold the value provided in constructor.