Ticket #133: numericFor-opt.patch
File numericFor-opt.patch, 2.0 KB (added by hopscc, 16 years ago) |
---|
-
Source/BackEndClr/SharpGenerator.cobra
2540 2540 .stop.writeSharpDef(sw) 2541 2541 sw.write(';\n') 2542 2542 2543 isSimpleStep = false 2543 2544 if .step is nil 2544 2545 sharpStep = '1' 2546 isSimpleStep = true 2545 2547 else if .step inherits IntegerLit 2546 2548 sharpStep = (.step to IntegerLit).asSharp 2549 isSimpleStep = (.step to IntegerLit).value > 0 2547 2550 else 2548 2551 sw.write('[sharpType] [sharpStep] = ') 2549 2552 .step.writeSharpDef(sw) 2550 2553 sw.write(';\n') 2551 2554 2552 sw.write('int [sharpDir] = [sharpStep] < 0 ? -1 : +1;\n') 2555 if not isSimpleStep 2556 sw.write('int [sharpDir] = [sharpStep] < 0 ? -1 : +1;\n') 2553 2557 2554 2558 sw.write('for(') 2555 2559 if trackLocals 2556 2560 sw.write('CobraLangInternal.CobraImp.SetLocal("[.var.name]", [sharpVar] = [sharpStart])') 2557 2561 else 2558 2562 sw.write('[sharpVar] = [sharpStart]') 2559 sw.write('; ([sharpDir]==1) ? [sharpVar] < [sharpStop] : [sharpVar] > [sharpStop]; ') 2563 if isSimpleStep 2564 sw.write('; [sharpVar] < [sharpStop] ; ') 2565 else 2566 sw.write('; ([sharpDir]==1) ? [sharpVar] < [sharpStop] : [sharpVar] > [sharpStop]; ') 2560 2567 if trackLocals 2561 2568 sw.write('CobraLangInternal.CobraImp.SetLocal("[.var.name]", [sharpVar] += [sharpStep])') 2562 2569 else -
Developer/IntermediateReleaseNotes.text
299 299 * Fixed: Cobra finds the definitions of identifiers in the parent namespaces of `used` namespaces, even when those parents themselves are not `used`. This leads to complications in practice when many namespaces are being used. ticket:128 300 300 301 301 * Fixed: Literals outside type range give internal error message. ticket:131 302 303 * Optimization: make new numeric For loop as fast as Old Numeric For Loop : ticket:133