Skip to content

Commit

Permalink
Rename http filter desugar class
Browse files Browse the repository at this point in the history
  • Loading branch information
ldclakmal committed Jun 11, 2021
1 parent a411f23 commit ba35b9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
*
* @since 0.974.1
*/
public class HttpFiltersDesugar {
public class DeclarativeAuthDesugar {

private final SymbolTable symTable;
private final SymbolResolver symResolver;
Expand All @@ -76,20 +76,20 @@ public class HttpFiltersDesugar {
private static final String WEBSOCKET_PACKAGE_NAME = "websocket";
private static final String AUTHENTICATE_RESOURCE = "authenticateResource";

private static final CompilerContext.Key<HttpFiltersDesugar> HTTP_FILTERS_DESUGAR_KEY =
private static final CompilerContext.Key<DeclarativeAuthDesugar> DECLARATIVE_AUTH_DESUGAR_KEY =
new CompilerContext.Key<>();

public static HttpFiltersDesugar getInstance(CompilerContext context) {
HttpFiltersDesugar desugar = context.get(HTTP_FILTERS_DESUGAR_KEY);
public static DeclarativeAuthDesugar getInstance(CompilerContext context) {
DeclarativeAuthDesugar desugar = context.get(DECLARATIVE_AUTH_DESUGAR_KEY);
if (desugar == null) {
desugar = new HttpFiltersDesugar(context);
desugar = new DeclarativeAuthDesugar(context);
}

return desugar;
}

private HttpFiltersDesugar(CompilerContext context) {
context.put(HTTP_FILTERS_DESUGAR_KEY, this);
private DeclarativeAuthDesugar(CompilerContext context) {
context.put(DECLARATIVE_AUTH_DESUGAR_KEY, this);
this.symTable = SymbolTable.getInstance(context);
this.symResolver = SymbolResolver.getInstance(context);
this.names = Names.getInstance(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class ServiceDesugar {
private final SymbolTable symTable;
private final SymbolResolver symResolver;
private final Names names;
private HttpFiltersDesugar httpFiltersDesugar;
private DeclarativeAuthDesugar declarativeAuthDesugar;
private TransactionDesugar transactionDesugar;
private final Types types;

Expand All @@ -96,7 +96,7 @@ private ServiceDesugar(CompilerContext context) {
this.symTable = SymbolTable.getInstance(context);
this.symResolver = SymbolResolver.getInstance(context);
this.names = Names.getInstance(context);
this.httpFiltersDesugar = HttpFiltersDesugar.getInstance(context);
this.declarativeAuthDesugar = DeclarativeAuthDesugar.getInstance(context);
this.transactionDesugar = TransactionDesugar.getInstance(context);
this.types = Types.getInstance(context);
}
Expand Down Expand Up @@ -299,6 +299,6 @@ private void engageCustomResourceDesugar(BLangFunction functionNode, SymbolEnv e
.createBeginParticipantInvocation(functionNode.pos));
((BLangBlockFunctionBody) functionNode.body).stmts.add(0, stmt);
}
httpFiltersDesugar.desugarFunction(functionNode, env, expressionTypes);
declarativeAuthDesugar.desugarFunction(functionNode, env, expressionTypes);
}
}

0 comments on commit ba35b9f

Please sign in to comment.