Skip to content

Commit

Permalink
Fix after removing other code
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreywolf committed Jan 10, 2020
1 parent 57b5b9a commit fa1331f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/diagrams/class/classRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ const drawClass = function(elem, classDef) {
}
};

const id = classDef.id;
const buildDisplayTextForMethod = function(txt) {
let regEx = /(\+|-|~|#)?(\w+)\((\w+\[?\]?)?\s?(\w+)?\)([*|$])?\s?(\w+\[?\]?)?/;
let regEx = /(\+|-|~|#)?(\w+)\s?\((\w+(<\w+>|\[\])?\s?(\w+)?)?\)\s?([*|$])?\s?(\w+(<\w+>|\[\])?)?/;

let cssStyle = '';
let displayText = txt;
let methodName = txt;
Expand All @@ -323,14 +323,13 @@ const drawClass = function(elem, classDef) {
let parsedText = txt.match(regEx);

if (parsedText) {
let visibility = parsedText[1] ? parsedText[1] : '';
methodName = parsedText[2] ? parsedText[2] : '';
let parameterType = parsedText[3] ? parsedText[3] : '';
let parameterName = parsedText[4] ? parsedText[4] : '';
classifier = parsedText[5] ? parsedText[5] : '';
let returnType = parsedText[6] ? ' : ' + parsedText[6] : '';
displayText =
visibility + methodName + '(' + parameterType + ' ' + parameterName + ')' + returnType;
let visibility = parsedText[1] ? parsedText[1].trim() : '';
methodName = parsedText[2] ? parsedText[2].trim() : '';
let parameters = parsedText[3] ? parsedText[3].trim() : '';
classifier = parsedText[6] ? parsedText[6].trim() : '';
let returnType = parsedText[7] ? ' : ' + parsedText[7].trim() : '';

displayText = visibility + methodName + '(' + parameters + ')' + returnType;
} else {
let methodEnd = displayText.indexOf(')') + 1;
classifier = displayText.substring(methodEnd, methodEnd + 1);
Expand All @@ -357,6 +356,7 @@ const drawClass = function(elem, classDef) {
return method;
};

const id = classDef.id;
const classInfo = {
id: id,
label: classDef.id,
Expand Down

0 comments on commit fa1331f

Please sign in to comment.