X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fmarkdown%2Fhtml%2FSCLDocumentationExtensionNodeHandler.java;h=bec138283039b19b42582922c70cf9aec23a717f;hp=d971f7d0faf8735fe1bb8377432e1de0fa34ff1b;hb=a8758de5bc19e5adb3f618d3038743a164f09912;hpb=12d9af17384d960b75d58c3935d2b7b46d93e87b diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java index d971f7d0f..bec138283 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java @@ -7,6 +7,7 @@ import org.simantics.scl.compiler.common.datatypes.Constructor; import org.simantics.scl.compiler.elaboration.modules.SCLValue; import org.simantics.scl.compiler.elaboration.modules.TypeClass; import org.simantics.scl.compiler.elaboration.modules.TypeConstructor; +import org.simantics.scl.compiler.elaboration.modules.TypeDescriptor; import org.simantics.scl.compiler.environment.filter.AcceptAllNamespaceFilter; import org.simantics.scl.compiler.errors.Failable; import org.simantics.scl.compiler.markdown.internal.ExtensionNodeHandler; @@ -279,11 +280,10 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle } private void generateDataDocumentation(Node container, Module module, String name) { - TypeConstructor typeConstructor = module.getTypeConstructor(name); - if(typeConstructor == null) { + TypeDescriptor typeDescriptor = module.getTypeDescriptor(name); + if(typeDescriptor == null) { StringBuilder error = new StringBuilder(); - error.append("Didn't find the type constructor '" + name + "'."); - System.err.println(error); + error.append("Didn't find the type " + name + "."); container.addChild(new CodeBlockNode(error)); return; } @@ -292,10 +292,12 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle StringBuilder signature = new StringBuilder(); signature.append("
"); signature.append("data "); - signature.append(typeConstructor.name.name); - for(TVar p : typeConstructor.parameters) { - signature.append(' '); - p.toName(tuc, signature); + signature.append(typeDescriptor.name.name); + if(typeDescriptor instanceof TypeConstructor) { + for(TVar p : ((TypeConstructor)typeDescriptor).parameters) { + signature.append(' '); + p.toName(tuc, signature); + } } String moduleName = module.getName(); if(!moduleName.equals(documentationName)) { @@ -304,17 +306,19 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle signature.append("
"); container.addChild(new HtmlNode(signature)); - if(typeConstructor.documentation != null) { + if(typeDescriptor.getDocumentation() != null) { MarkdownParser parser = new MarkdownParser(); - container.addChild(parser.parseDocument(typeConstructor.documentation)); + container.addChild(parser.parseDocument(typeDescriptor.getDocumentation())); } else System.out.println(name); - for(Constructor constructor : typeConstructor.constructors) { - if(!documentedValues.add(constructor.name.name)) - System.err.println("Method '" + constructor.name.name + "' has already been documented in " + documentationName + "."); - generateValueDocumentation(container, module, constructor.name.name, new TypeUnparsingContext(tuc)); + if(typeDescriptor instanceof TypeConstructor) { + for(Constructor constructor : ((TypeConstructor)typeDescriptor).constructors) { + if(!documentedValues.add(constructor.name.name)) + System.err.println("Method '" + constructor.name.name + "' has already been documented in " + documentationName + "."); + generateValueDocumentation(container, module, constructor.name.name, new TypeUnparsingContext(tuc)); + } } container.addChild(new HtmlNode("
")); }