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

feat(csharp,java): support aliasing imports #115

Merged
4 changes: 2 additions & 2 deletions lib/codegen/fromcto/csharp/csharpvisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

'use strict';

const { ModelUtil, ModelFile } = require('@accordproject/concerto-core');
const { ModelUtil } = require('@accordproject/concerto-core');
const camelCase = require('camelcase');
const { throwUnrecognizedType } = require('../../../common/util');

Expand Down 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 instanceof ModelFile && modelFile.isImportedType(fieldType)) {
if (modelFile?.isImportedType?.(fieldType)) {
fieldType = modelFile.getImportedType(fieldType);
}
fieldType = `${fqn}${fieldType}`;
Expand Down
3 changes: 1 addition & 2 deletions lib/codegen/fromcto/java/javavisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

'use strict';

const { ModelFile } = require('@accordproject/concerto-core');
const EmptyPlugin = require('./emptyplugin');
const ModelUtil = require('@accordproject/concerto-core').ModelUtil;
const util = require('util');
Expand Down Expand Up @@ -271,7 +270,7 @@ class JavaVisitor {
let fieldType = field.getType();
if (!ModelUtil.isPrimitiveType(fieldType)) {
const modelFile = field.getModelFile();
if (modelFile instanceof ModelFile && modelFile.isImportedType(fieldType)) {
if (modelFile?.isImportedType?.(fieldType)) {
fieldType = modelFile.getImportedType(fieldType);
}
}
Expand Down