Skip to content

Commit

Permalink
feat(alias-import): Pr suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Jaskeerat Singh Saluja <[email protected]>
  • Loading branch information
Jaskeerat Singh Saluja authored and Jaskeerat Singh Saluja committed Sep 3, 2024
1 parent e238635 commit c204762
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/codegen/fromcto/csharp/csharpvisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class CSharpVisitor {
} else if (!field.isPrimitive()) {
let fqn = this.getDotNetNamespaceOfType(field.getFullyQualifiedTypeName(), field.getParent(), parameters);
const modelFile = field.getModelFile();
if (modelFile?.isImportedType?.(fieldType)) {
if (modelFile?.isImportedType(fieldType)) {
fieldType = modelFile.getImportedType(fieldType);
}
fieldType = `${fqn}${fieldType}`;
Expand Down
2 changes: 1 addition & 1 deletion lib/codegen/fromcto/java/javavisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class JavaVisitor {
let fieldType = field.getType();
if (!ModelUtil.isPrimitiveType(fieldType)) {
const modelFile = field.getModelFile();
if (modelFile?.isImportedType?.(fieldType)) {
if (modelFile?.isImportedType(fieldType)) {
fieldType = modelFile.getImportedType(fieldType);
}
}
Expand Down
4 changes: 3 additions & 1 deletion test/codegen/fromcto/java/javavisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,10 @@ describe('JavaVisitor', function () {

const mockField = sinon.createStubInstance(Field);
const getType = sinon.stub();
const isImportedType = sinon.stub();

mockField.ast = { type: { name: 'Dummy Value'} };
mockField.getModelFile.returns({ getType: getType });
mockField.getModelFile.returns({ getType: getType, isImportedType: isImportedType });

const mockMapDeclaration = sinon.createStubInstance(MapDeclaration);
const getKeyType = sinon.stub();
Expand All @@ -481,6 +482,7 @@ describe('JavaVisitor', function () {
getType.returns(mockMapDeclaration);
getKeyType.returns('String');
getValueType.returns('String');
isImportedType.returns(false);
mockField.getName.returns('Map1');
mockMapDeclaration.getName.returns('Map1');
mockMapDeclaration.isMapDeclaration.returns(true);
Expand Down

0 comments on commit c204762

Please sign in to comment.