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

Improve desugar implementation for websocket auth #31045

Merged
merged 3 commits into from
Jun 9, 2021

Conversation

ldclakmal
Copy link
Member

@ldclakmal ldclakmal commented Jun 8, 2021

Purpose

$subject

Related to: #27894
Related to: ballerina-platform/ballerina-library#1405
Related to: ballerina-platform/ballerina-library#584

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@ldclakmal ldclakmal requested a review from rdhananjaya June 8, 2021 13:34
@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #31045 (3fc4a76) into master (1ee5bb5) will increase coverage by 0.02%.
The diff coverage is 6.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31045      +/-   ##
============================================
+ Coverage     70.37%   70.39%   +0.02%     
- Complexity    37832    37881      +49     
============================================
  Files          2846     2844       -2     
  Lines        155873   155996     +123     
  Branches      19475    19506      +31     
============================================
+ Hits         109688   109813     +125     
+ Misses        39795    39785      -10     
- Partials       6390     6398       +8     
Impacted Files Coverage Δ
...erinalang/compiler/desugar/HttpFiltersDesugar.java 22.78% <4.54%> (-4.34%) ⬇️
...ballerinalang/compiler/desugar/ServiceDesugar.java 92.24% <100.00%> (+8.56%) ⬆️
.../compiler/semantics/analyzer/ConstantAnalyzer.java 88.67% <0.00%> (-3.16%) ⬇️
...ontext/RecordFieldWithDefaultValueNodeContext.java 60.00% <0.00%> (-2.23%) ⬇️
.../org/ballerinalang/langserver/hover/HoverUtil.java 81.67% <0.00%> (-1.56%) ⬇️
...c/main/java/io/ballerina/projects/JarResolver.java 90.00% <0.00%> (-0.67%) ⬇️
...ngserver/completions/util/ContextTypeResolver.java 70.76% <0.00%> (-0.14%) ⬇️
.../compiler/semantics/analyzer/SemanticAnalyzer.java 81.23% <0.00%> (-0.09%) ⬇️
...ava/io/ballerina/runtime/internal/TypeChecker.java 76.84% <0.00%> (-0.09%) ⬇️
.../java/io/ballerina/projects/JBallerinaBackend.java 72.26% <0.00%> (-0.04%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ee5bb5...3fc4a76. Read the comment docs.

}
}

boolean isValidPackage(List<BType> expressionTypes, String packageName) {
Copy link
Member

Choose a reason for hiding this comment

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

I this this should be something like isDefinedInStdLibPackage

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Fixed with f29c2b1

result.var.symbol = resultSymbol;
}

void addWebSocketAuthDesugarFunctionInvocation(BLangFunction functionNode, SymbolEnv env) {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these 2 methods do the kind of same things, shall we try to extract common code into methods and re-use them in this 2 methods.

Copy link
Member Author

@ldclakmal ldclakmal Jun 9, 2021

Choose a reason for hiding this comment

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

Agree. Updated into a single method with f29c2b1.

return pkg.symbol;
}
}
// This resolves the package symbol when the code is at a submodule of the module which have the service
// definition. In that case there is no any import relevant to the particular service.
Copy link
Member

Choose a reason for hiding this comment

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

This resolves the package symbol when the code is at a submodule of the module which have the listener definition.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated with f29c2b1

@rdhananjaya rdhananjaya added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/Desugar Issue related Desugar and Code optimizer #Compiler Lang/ListenerDeclaration Issues related to listener declarations. labels Jun 9, 2021
rdhananjaya
rdhananjaya previously approved these changes Jun 9, 2021
Copy link
Member

@rdhananjaya rdhananjaya left a comment

Choose a reason for hiding this comment

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

Changes look good to me

@ldclakmal ldclakmal merged commit 5f7106e into ballerina-platform:master Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Desugar Issue related Desugar and Code optimizer #Compiler Lang/ListenerDeclaration Issues related to listener declarations. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants