Ticket #8: forDeprec1.patch
File forDeprec1.patch, 20.8 KB (added by hopscc, 16 years ago) |
---|
-
Source/Members.cobra
261 261 otherParams = member.params 262 262 if params.count <> otherParams.count 263 263 return false 264 for i = 0 ..params.count264 for i in 0 : params.count 265 265 if params[i].type <> otherParams[i].type 266 266 return false 267 267 return true … … 686 686 name.length 687 687 .findLocal(name) 688 688 body 689 for i = 0 .._locals.count689 for i in 0 : _locals.count 690 690 if _locals[i].name==name 691 691 _locals.removeAt(i) 692 692 break … … 1717 1717 # sanity check that members don't have the same signature 1718 1718 #if name <> 'getType' # TODO: HACK: See Box.prepSystemObjectClass 1719 1719 # TODO: having problems with explicit interface implementation. I think these probably should have their name changed from "foo" to "Type.foo" 1720 # for i = 0 .._members.count1721 # for j = i+1 .._members.count1720 # for i in 0 : _members.count 1721 # for j in i+1 : _members.count 1722 1722 # assert not _members[i].matchesSignature(_members[j]) 1723 1723 # rename the test members of the overload by suffixing them with '_o1' '_o2' etc. 1724 1724 … … 1943 1943 # parameter names can be different 1944 1944 sw.write('{\n') 1945 1945 sw.indent 1946 for i = 0 .._codeMember.params.count1946 for i in 0 : _codeMember.params.count 1947 1947 ourParam = _codeMember.params[i] 1948 1948 ancestorParam = curCodeMember.params[i] 1949 1949 if ourParam.name <> ancestorParam.name # this is the problem`; name mismatch … … 1966 1966 # at this point in C# code, all requirements have failed 1967 1967 if n > 1 1968 1968 sw.write('throw re1;\n') 1969 for m = 1 ..n1969 for m in 1 : n 1970 1970 sw.dedent 1971 1971 sw.write('}\n') 1972 1972 count -= 1 -
Source/Tokenizer.cobra
721 721 t.sort 722 722 if v 723 723 print '{[key]}' 724 for i = 0 ..t.count724 for i in 0 : t.count 725 725 print ' [i]. [t[i]]' 726 726 _tokenDefsStack.push(TokenDefSet(defs, defsByWhich, defsByFirstChar)) 727 727 _tokenDefs = defs -
Source/Expr.cobra
207 207 else 208 208 sugg = ' There are members with similar names including ' 209 209 sep = '' 210 for i = 0 ..suggs.count210 for i in 0 : suggs.count 211 211 sugg += '[sep]"[suggs[i]]"' 212 212 sep = if(i<suggs.count-2, ', ', ' and ') 213 213 sugg += '.' … … 723 723 else 724 724 .throwError('The method "[definition.name]" is expecting [params.count] argument[Utils.plural(params)], but [args.count] are being supplied in this call.') 725 725 if check 726 for i = 0 ..args.count726 for i in 0 : args.count 727 727 arg = args[i] 728 728 param = params[i] 729 729 if arg.hasError … … 1396 1396 params = indexer.params 1397 1397 if args.count <> params.count 1398 1398 .throwError('The method "[_definition.name]" is expecting [params.count] argument[Utils.plural(params)], but [args.count] are being supplied in this call.') 1399 for i = 0 ..args.count1399 for i in 0 : args.count 1400 1400 arg = args[i] 1401 1401 param = params[i] 1402 1402 if arg.hasError -
Source/Boxes.cobra
45 45 base.init(token, name, isNames, docString) 46 46 _attribs = attribs 47 47 _genericParams = paramList 48 for i = 0 .._genericParams.count48 for i in 0 : _genericParams.count 49 49 p = _genericParams[i] 50 50 if p inherits GenericParam 51 51 p.index = i … … 320 320 321 321 # okay to sort by alpha, but if a name differs only by case, put it up front 322 322 lowerName = name.toLower 323 for i = 0 ..suggs.count323 for i in 0 : suggs.count 324 324 if suggs[i].toLower == lowerName 325 325 sugg = suggs[i] 326 326 suggs.removeAt(i) … … 789 789 790 790 # TODO: can take this out. it's just a check that the above comparison is working. 2007-12-08 791 791 equal = true 792 for i = 0 ..typeArgs.count792 for i in 0 : typeArgs.count 793 793 if typeArgs[i] <> .genericParams[i] 794 794 equal = false 795 795 break … … 830 830 t._clrType = nil # The constructed type is really sourced from the generic def. Don't foster confusion with a reference to the original generic def's clr type (if there is one). 831 831 t.cloneCollections 832 832 # set the contructed type args immediately or its ancestors will get the original generic args during _bindInt: 833 for i = 0 ..typeArgs.count833 for i in 0 : typeArgs.count 834 834 t._genericParams[i] = typeArgs[i] 835 835 assert t._constructedTypes is nil or t._constructedTypes.count == 0 836 836 if .didBindInt … … 882 882 883 883 _baseClass = _baseClass.secondaryConstructedTypeFor(this, gpToType) to Class 884 884 assert _baseInterfaceProxies.count == 0 or _baseInterfaceProxies.count == _baseInterfaces.count 885 for i = 0 .._baseInterfaces.count885 for i in 0 : _baseInterfaces.count 886 886 _baseInterfaces[i] = _baseInterfaces[i].secondaryConstructedTypeFor(this, gpToType) to Interface 887 887 888 888 # construct the declarations -
Source/BinaryOpExpr.cobra
339 339 sharpNames = _left.sharpAssignmentNames 340 340 if sharpNames and sharpNames.count 341 341 sharpNames.reverse 342 for i = 0 ..sharpNames.count342 for i in 0 : sharpNames.count 343 343 sw.write(if(i==0, '', '=')) 344 344 assert sharpNames[i].length 345 345 sw.write(sharpNames[i]) -
Source/Node.cobra
837 837 iw.writeLine('') 838 838 iw.indent 839 839 try 840 for i = 0 ..value.count840 for i in 0 : value.count 841 841 iw.write('[i]=') 842 842 if (node = value[i]) inherits Node 843 843 node._writeDeepString(iw, node, doMin, doRef, doSub) -
Source/Module.cobra
60 60 if false 61 61 # kind of silly, but it works: 62 62 d = Dictionary<of int, int>() 63 for i = 1 ..Utils.countChars(File.readAllText(_sharpFileName), c'\n')+163 for i in 1 : Utils.countChars(File.readAllText(_sharpFileName), c'\n')+1 64 64 d[i] = i 65 65 return d 66 66 return nil -
Source/IndentedWriter.cobra
154 154 def _setTotalIndentString 155 155 is protected 156 156 sb = StringBuilder() 157 for i = 0 .._indentLevel157 for i in 0 : _indentLevel 158 158 sb.append(_indentString) 159 159 _totalIndentString = sb.toString 160 160 -
Source/CobraLang.cobra
1042 1042 if obj.getType.name.startsWith('List`') 1043 1043 dobj = obj to dynamic 1044 1044 count = dobj.count to int 1045 for j = 0 ..count1045 for j in 0:count 1046 1046 try 1047 1047 value = dobj[j] 1048 1048 catch exc as Exception … … 1179 1179 _args = $sharp(r'(object[])args.Clone()') 1180 1180 _locals = Dictionary<of String, dynamic?>() 1181 1181 _localNamesInOrder = List<of String>() 1182 for j = 0 .. _args.length ++21182 for j in 0:_args.length:2 1183 1183 .setLocal(_args[j] to String, _args[j+1]) 1184 1184 1185 1185 def setLocal(name as String, value as dynamic?) … … 1191 1191 nameWidth = 8 1192 1192 tw.writeLine('\n [i]. [this]') 1193 1193 tw.writeLine(' args') 1194 for j = 0 .. _args.length ++21194 for j in 0:_args.length:2 1195 1195 tw.write(String.format(' {0} = ', (_args[j] to String).padRight(nameWidth))) 1196 1196 try 1197 1197 s = CobraCore.toTechString(_args[j+1]) … … 1219 1219 tw.writeLine('<tr class=frameHead> <td class=number> [i]. </td> <td class=qualifiedMember colspan=4> [_declClassName].[_methodName] </td> </tr> ') 1220 1220 tw.writeLine('<tr class=frameDetails1> <td class=indent> </td> <td class=label width=1> at: </td> <td class=sourceLocation colspan=3> [SourceSite.htmlForAtArgs(_fileName, _lineNum)] </td> </tr>') 1221 1221 rowNum = 1 1222 for j = 0 .. _args.length ++21222 for j in 0:_args.length:2 1223 1223 name = _args[j] to String 1224 1224 value = _args[j+1] to dynamic? 1225 1225 label = if(j==0, 'args:', '') -
Source/CobraParser.cobra
204 204 try 205 205 tokens = tokenizer.startSource(_fileName, source).allTokens 206 206 _tokens = List<of IToken>(tokens.count) 207 for i = 0 ..tokens.count207 for i in 0 : tokens.count 208 208 if tokens[i].text == '_' and tokens[i].which == 'ID' 209 209 if i < tokens.count-1 and tokens[i+1].which == 'EOL' 210 210 i += 1 … … 733 733 """ 734 734 name = token.text.trim 735 735 if token.which=='OPEN_GENERIC' 736 for i = 0 ..paramList.count-1736 for i in 0 : paramList.count-1 737 737 name += ',' 738 738 name += '>' 739 739 return name … … 1876 1876 deprecated 2008-03: the use of .. and ++ just doesn't relate to anything 1877 1877 See forEnumerableStmt below. 1878 1878 """ 1879 _warning("\nNumericForStatement by assignment (for var = start .. stop) deprecated 2008-03." + _ 1880 " Please change to use new form (for var in start:stop:step) before 2009-03") 1879 1881 .expect('ASSIGN') 1880 1882 start = .expression 1881 1883 .expect('DOTDOT') -
Source/Types.cobra
565 565 parts = name.split(c'`') 566 566 count = int.parse(parts[1]) to int 567 567 cobraName = parts[0] + '<of' 568 for i = 1 ..count568 for i in 1 : count 569 569 cobraName += ',' 570 570 cobraName += '>' 571 571 _cobraNameForSharpGenericNameCache[name] = cobraName … … 2118 2118 _fullName = fullName 2119 2119 _typeRefName = _rootName + '<of' 2120 2120 # TODO: String(c',', _typeNodes.count-1) ? 2121 for i = 0 .._typeNodes.count-12121 for i in 0 : _typeNodes.count-1 2122 2122 _typeRefName += ',' 2123 2123 _typeRefName += '>' 2124 2124 _name = _typeRefName -
Source/dump-stack.cobra
19 19 sum = x + y 20 20 name = 'aoeu' 21 21 c = _customer = Customer('Castlewood Consulting', 1042.17) 22 for i = 0 ..322 for i in 0 : 3 23 23 print i 24 24 for j in [0, 1, 2] 25 25 print j -
Source/TestifyRunner.cobra
423 423 catch StopCompilation 424 424 assert c.errors.count 425 425 expectedErrors = error.split(c'&') 426 for i = 0 ..expectedErrors.length426 for i in 0 : expectedErrors.length 427 427 expectedError = expectedErrors[i].trim 428 428 print 'Expecting error substring [i+1] of [expectedErrors.length]: **[expectedError]**' 429 429 if i >= c.errors.count … … 439 439 print 'Matches: "[actualError.message]"' 440 440 if c.errors.count > expectedErrors.length 441 441 print 'There are more actual errors than expected errors:' 442 for i = expectedErrors.length ..c.errors.count442 for i in expectedErrors.length : c.errors.count 443 443 print 'Another actual error: [c.errors[i].message]' 444 444 .failed 445 445 return 0 … … 474 474 .failed 475 475 return 0 476 476 expectedWarnings = warning.split(c'&') 477 for i = 0 ..expectedWarnings.length477 for i in 0 : expectedWarnings.length 478 478 expectedWarning = expectedWarnings[i].trim 479 479 print 'Expecting warning substring [i+1] of [expectedWarnings.length]: **[expectedWarning]**' 480 480 if i >= c.warnings.count … … 490 490 print 'Matches: "[actualWarning.message]"' 491 491 if c.warnings.count > expectedWarnings.length 492 492 print 'There are more actual warnings than expected warnings:' 493 for i = expectedWarnings.length ..c.warnings.count493 for i in expectedWarnings.length : c.warnings.count 494 494 print 'Another actual warning: [c.warnings[i].message]' 495 495 .failed 496 496 return 0 -
Source/OperatorSpecs.cobra
91 91 for row in _table 92 92 parts = row.split(c',') 93 93 assert parts.length == 5, row 94 for i = 0 ..parts.length94 for i in 0 : parts.length 95 95 parts[i] = parts[i].trim 96 96 spec = OpSpec(parts) 97 97 _opSpecs.add(spec) -
Tests/500-dynamic/126-dynamic-statements.cobra
72 72 for dk in da : db 73 73 assert dk > 0 and dk >= da and dk < db 74 74 75 for x = 2 ..1075 for x in 2:10 76 76 assert x >= 2 and x <= 10 77 for xq = 2 ..1077 for xq in 2:10 78 78 assert xq >= 2 and x <= 10 79 79 80 80 da as dynamic = 1 81 for di = da ..1081 for di in da:10 82 82 assert di > 0 and di < 10 83 83 db as dynamic = 10 84 for dj = 1 ..db84 for dj in 1:db 85 85 assert dj > 0 and dj < db 86 for dk = da ..db86 for dk in da:db 87 87 assert dk > 0 and dk >= da and dk < db 88 88 89 89 -
Tests/120-classes/804-test.cobra
18 18 assert c==c'a' 19 19 body 20 20 sb as StringBuilder = StringBuilder() 21 for i as int = 0 ..length21 for i as int in 0:length 22 22 CobraCore.noOp(i) 23 23 c as char = alphabet[_random.next(alphabet.length)] 24 24 sb.append(c) -
Tests/800-warnings/310-deprec-for.cobra
1 class DeprecFor 2 3 4 def main is shared 5 DeprecFor().run 6 7 def run 8 for i = 0 .. 10 ++ 2 # .warning. deprecated 9 assert i+1 > 0 and i<10 -
Tests/240-generics/100-use-generics-collections/122-use-cobra-set.cobra
29 29 30 30 # test that 'in' is fast 31 31 x = 10000 32 for i = 0 ..x32 for i in 0:x 33 33 s.add(i) 34 34 t.add(i) 35 35 x -= 1 … … 37 37 reps = 1000 38 38 39 39 start = DateTime.now 40 for n = 0 ..reps40 for n in 0:reps 41 41 assert x in s 42 42 assert x in s 43 43 assert x in s … … 46 46 setTest = DateTime.now.subtract(start).totalSeconds 47 47 48 48 start = DateTime.now 49 for n = 0 ..reps49 for n in 0:reps 50 50 assert x in t 51 51 assert x in t 52 52 assert x in t … … 66 66 # same thing, but 'not in' 67 67 x += 1 68 68 start = DateTime.now 69 for n = 0 ..reps69 for n in 0:reps 70 70 assert x not in s 71 71 assert x not in s 72 72 assert x not in s … … 75 75 setTest = DateTime.now.subtract(start).totalSeconds 76 76 77 77 start = DateTime.now 78 for n = 0 ..reps78 for n in 0:reps 79 79 assert x not in t 80 80 assert x not in t 81 81 assert x not in t -
Tests/100-basics/140-break.cobra
12 12 assert x==0 13 13 14 14 x = 1 15 for i as int = 1 ..1015 for i as int in 1:10 16 16 break 17 17 x = i 18 18 assert x==1 -
Tests/100-basics/150-continue.cobra
15 15 assert count==0 16 16 17 17 x = 1 18 for i as int = 1 ..1018 for i as int in 1 : 10 19 19 x = i 20 20 continue 21 21 count += 1 -
Tests/100-basics/120-for-numeric.cobra
12 12 13 13 # the usual for numeric: 14 14 count = 0 15 for x as int = 0 ..10015 for x as int in 0:100 16 16 r = x 17 17 count += 1 18 18 assert r==99 … … 21 21 22 22 # with a ++ 23 23 count = 0 24 for x as int = 0 .. 100 ++224 for x as int in 0:100:2 25 25 r = x 26 26 count += 1 27 27 assert r==98 … … 29 29 assert count==50 30 30 31 31 count = 0 32 for x as int = 1 .. 100 ++232 for x as int in 1:100:2 33 33 r = x 34 34 count += 1 35 35 assert r==99 … … 37 37 38 38 # reverse order 39 39 count = 0 40 for x = 100 .. 0 --140 for x in 100:0:-1 41 41 r = x 42 42 count += 1 43 43 assert r==1, r … … 45 45 46 46 # by 2 47 47 count = 0 48 for x = 100 .. 0 --248 for x in 100:0:-2 49 49 r = x 50 50 count += 1 51 51 assert r==2 … … 53 53 54 54 # continue 55 55 count = 0 56 for x = 1 ..1056 for x in 1 : 10 57 57 r = x 58 58 continue 59 59 count += 1 … … 65 65 def more 66 66 i = 1 67 67 # reuse a local 68 for i = 1 ..1068 for i in 1:10 69 69 assert i 70 70 assert i == 10 71 71 … … 75 75 def foo(x as int) 76 76 assert x == 5 77 77 # reuse an arg: 78 for x = 1 ..1078 for x in 1:10 79 79 assert x 80 80 assert x == 10 81 81 … … 84 84 def bar 85 85 assert _b == 0 86 86 # reuse a class var: 87 for _b = 1 ..1087 for _b in 1:10 88 88 assert _b 89 89 assert _b == 10 -
Tests/320-misc-two/402-implement-IEnumerable.cobra
5 5 6 6 def init(max as int) 7 7 _numbers = List<of int>() 8 for i = 0 ..max8 for i in 0:max 9 9 _numbers.add(i) 10 10 11 11 def getEnumerator as IEnumerator<of int> -
Tests/110-basics-two/800-arrays/100-single-dim-array.cobra
9 9 for i as int in numbers 10 10 assert i==0 11 11 12 for i = 0 ..numbers.length12 for i in 0:numbers.length 13 13 assert numbers[i]==0 14 14 numbers[i] = i 15 15 assert numbers[i]==i -
Tests/300-type-inference/140-for.cobra
3 3 def main 4 4 is shared 5 5 6 for i = 0 ..106 for i in 0:10 7 7 assert i < 10 8 8 assert i==10 9 9 10 10 n = 10 11 for i = 0 ..n11 for i in 0:n 12 12 assert i < n 13 13 14 14 for arg in CobraCore.commandLineArgs -
Tests/300-type-inference/142-for.cobra
4 4 5 5 i = 1 # declaring i before using it in a for loop used to cause a false error about UnknownType 6 6 7 for i = 0 ..107 for i in 1:10 8 8 assert i < 10 -
Developer/IntermediateReleaseNotes.text
44 44 * Fixed: Method return types from generics in DLLs are always considered nilable even if the generic parameter was not (such as `bool`). ticket:22 45 45 46 46 * Fixed: Assignments (and other side effects) can appear in assert conditions even though they might be excluded during compilation or run-time. ticket:4 (hopscc) 47 48 * Fixed: Make so that use of old style "for" statement generates a deprecation warning