Repository navigation
perf(check): sweep a document's expressions for typed by only while one is unreported #1744
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
67993d1
perf(check): sweep a document's expressions for typed by only while o…
devin-ai-integration[bot] 755faab
docs(changes): write the fragment as the list item the changelog chec…
devin-ai-integration[bot] 1a0155b
fix(parser): rewind the typed-by count with a speculative parse
devin-ai-integration[bot] cd077d9
fix(libs): bump the snapshot format for the root's typed-by count
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - The nonstandard-notation pass no longer walks every expression of a document looking for a `typed by` on a body-expression parameter (#1478) when the document spells none: the parser counts the spellings and the pass sweeps only while one is unreported. Loading a generated 1 000-element model allocates 58.5 MB instead of 61.2 MB, recovering most of what #1478 added over 0.11.0's 58.2 MB on the same toolchain; the remaining 0.3 MB is other work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package parser | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/Open-MBEE/OpenSysML/internal/syntax/source" | ||
| ) | ||
|
|
||
| // The document counts its `typed by` spellings (RootNamespace.TypedBy), on | ||
| // declarations, prefix metadata and body-expression parameters alike, so a | ||
| // pass that reports the spelling knows when it has found them all. | ||
| func TestRootNamespaceCountsTypedBy(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| src string | ||
| want int | ||
| }{ | ||
| {"none", "package P { part def A; part a : A; }", 0}, | ||
| {"typed_as_name", "package P { attribute typed; }", 0}, | ||
| {"declaration", "package P { part def A; part a typed by A; }", 1}, | ||
| {"two_declarations", "package P { part def A; part a typed by A; part b typed by A, A; }", 2}, | ||
| {"prefix_metadata", "package P { metadata def M; @ m typed by M; }", 1}, | ||
| {"body_parameter", "package P { part def A; calc c { in x; return y = x.{ in v typed by A; v }; } }", 1}, | ||
| {"end_without_cross_feature", "package P { part def A; connection def C { end x typed by A; end y typed by A; } }", 2}, | ||
| {"kerml_feature", "package P { classifier A; feature f typed by A; }", 1}, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| p := New(source.New(tt.name+".sysml", []byte(tt.src))) | ||
| root := p.ParseFile() | ||
| if root.TypedBy != tt.want { | ||
| t.Errorf("RootNamespace.TypedBy = %d, want %d", root.TypedBy, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.