Ticket #277: namespace-docstr.patch
File namespace-docstr.patch, 3.1 KB (added by hopscc, 13 years ago) |
---|
-
Source/NameSpace.cobra
151 151 .addDecl(ns) 152 152 return ns 153 153 154 def addDocString(docString as String) 155 require docString.length 156 if not docString.trim.length, return 157 if not .docString.length 158 .docString = docString 159 else if .docString <> docString 160 sb = StringBuilder( .docString) 161 sb.append('\n') 162 sb.append(docString) 163 .docString = sb.toString 164 165 154 166 get typeForIdentifier as IType? is override 155 167 # TODO: in reality, you can't say "x = SomeNameSpace" or pass a 156 168 # namespace as an argument. That should be fixed by allowing those -
Source/CobraParser.cobra
1124 1124 _nameSpaceStack.push(curNameSpace) 1125 1125 try 1126 1126 .indent 1127 docString = .docString 1128 if docString and docString.length, curNameSpace.addDocString(docString to !) 1129 .zeroOrMore('EOL') 1127 1130 while true 1128 1131 peek = .peek 1129 1132 if peek is nil, .throwError('Expecting a namespace member, but source code ended.') -
Tests/120-classes/920-doc-strings-namespace-0.cobra
1 namespace DocStrTest 2 """ 3 Namespace Docstring test 4 """ 5 class Test 6 def main is shared 7 assert true -
Tests/120-classes/920-doc-strings-namespace-2.cobra
1 namespace DocStrTest 2 """ A oneline namespace Docstring """ 3 4 class Test 5 def main is shared 6 assert true -
Tests/120-classes/920-doc-strings-namespace-1.cobra
1 namespace DocStrTest 2 """ 3 A Test Docstring 4 """ 5 6 class Test 7 def main is shared 8 assert true -
Tests/120-classes/920-doc-strings-namespace-3.cobra
1 """ 2 Module Docstring 3 Test for Ticket:277 4 """ 5 6 namespace NamespaceDocStrTest 7 """ 8 Namespace Docstring 9 """ 10 11 class Test 12 """My Test class docstr. - oneline""" 13 14 var anI =10 15 """docStr on anIfield""" 16 17 def main is shared 18 """ 19 My main method docstr. 20 multiline 21 """ 22 23 assert true