Ticket #207: warn-deprecated-sharp-keyword.patch
File warn-deprecated-sharp-keyword.patch, 6.8 KB (added by hopscc, 14 years ago) |
---|
-
Source/TypeProxies.cobra
286 286 287 287 def _hack(clrType as Type) as IType 288 288 if clrType.isInterface 289 return ClrTypeProxy( $sharp('typeof(System.ICloneable)')).realType289 return ClrTypeProxy(sharp'typeof(System.ICloneable)').realType 290 290 else 291 291 return ClrTypeProxy(Object).realType 292 292 -
Source/SyntaxHighlighter.cobra
184 184 on 'SHARP_SINGLE' or 'SHARP_DOUBLE' # sharp'...' 185 185 .add(charNum, 5, 'kw', 'sharp') 186 186 .add(charNum+5, len-5, 'ls', text[5:]) 187 on 'SHARP_OPEN' 188 .add(charNum, 6, 'kw', '$sharp') 187 on 'SHARP_OPEN' 188 .add(charNum, 6, 'kw', '$sharp') # deprecated 189 189 on 'STRING_START_SINGLE' or 'STRING_START_DOUBLE' 190 190 .add(charNum, len-1, 'ls', text[:-1]) 191 191 .add(charNum+len-1, 1, 'lslb', '\[') -
Source/Expr.cobra
1899 1899 if expr inherits StringLit # TODO:? make this an arg type 1900 1900 _expr = expr 1901 1901 else 1902 assert false, r' $sharp expression must be a String Literal (No substitutions) expr=[expr]'1902 assert false, r'sharp expression must be a String Literal (No substitutions) expr=[expr]' 1903 1903 1904 1904 get allExprs as Expr* 1905 1905 for expr in base.allExprs, yield expr … … 1914 1914 quote = if(.token.text.startsWith('sharp"'), '"', "'") 1915 1915 return "sharp[quote][_sharpSource][quote]" 1916 1916 else 1917 return " $sharp('[_expr.toCobraSource]')"1917 return "sharp'[_expr.toCobraSource]'" 1918 1918 1919 1919 def _bindImp is override 1920 1920 base._bindImp -
Source/Compiler.cobra
711 711 # TODO: try this out on MS .NET and if it works there, use it there 712 712 # TODO: file a Mono bug report (or ping an existing one) 713 713 # curDomain = AppDomain.currentDomain 714 # $sharp('curDomain.ReflectionOnlyAssemblyResolve += _resolveEvent')714 # sharp'curDomain.ReflectionOnlyAssemblyResolve += _resolveEvent' 715 715 716 716 for reference in references 717 717 if not .loadReference(reference) -
Source/Cobra.Lang/CobraFrame.cobra
19 19 _methodName = methodName 20 20 _fileName = fileName 21 21 _lineNum = lineNum 22 _args = $sharp(r'(object[])args.Clone()')22 _args = sharp'(object[])args.Clone()' 23 23 _locals = Dictionary<of String, dynamic?>() 24 24 _localNamesInOrder = List<of String>() 25 25 for j = 0 .. _args.length ++ 2 -
Source/IndentedWriter.cobra
39 39 ## Other 40 40 41 41 def dispose is new 42 # $sharp('base.Dispose();')43 $sharp('_innerWriter.Dispose();')44 42 #sharp'base.Dispose();' 43 #sharp'_innerWriter.Dispose();' 44 _innerWriter.dispose 45 45 46 46 class IndentedWriter 47 47 inherits TextWriter … … 142 142 ## Other 143 143 144 144 def dispose is new 145 #$sharp('base.Dispose();') 146 $sharp('_innerWriter.Dispose();') 147 145 #sharp'base.Dispose();' 146 #sharp'_innerWriter.Dispose();' 147 _innerWriter.dispose 148 148 149 # *** Private Util *** 149 150 150 151 def _setTotalIndentString -
Source/CobraParser.cobra
3327 3327 on 'SHARP_DOUBLE' 3328 3328 assert token.text.startsWith('sharp"') 3329 3329 return SharpExpr(token, token.text['sharp"'.length:-1]) 3330 on 'SHARP_OPEN' 3330 on 'SHARP_OPEN' # deprecated 3331 3331 expr = .expression 3332 3332 .expect('RPAREN') 3333 sharpStr="sharp'...'" 3334 _warning('sharp-open expression ("$sharp(...)" deprecated. Please use a sharp string literal instead (sharp"..." or [sharpStr])') 3333 3335 return SharpExpr(token, expr) 3334 3336 else 3335 3337 throw FallThroughException(token) -
Tests/110-basics-two/502-sharp.cobra
9 9 .oldSyntax 10 10 11 11 def oldSyntax is shared 12 i as int = $sharp('2+2') 12 i as int = $sharp('2+2') #.warning. deprecated 13 13 assert i==4 14 i = $sharp('i*2') 14 i = $sharp('i*2') #.warning. deprecated 15 15 assert i==8 -
Tests/110-basics-two/100-using.cobra
10 10 buffer = StringWriter() 11 11 using sr = File.openText(path) 12 12 print to buffer, sr.readLine 13 assert $sharp('sr == null')# assert sharp is nil13 assert sharp'sr == null' # assert sharp is nil 14 14 assert buffer.toString.length -
Tests/110-basics-two/101-using.cobra
14 14 def main is shared 15 15 using sr = File.openText(.fileName) 16 16 print sr.readLine 17 assert $sharp('sr == null')# assert sr is nil17 assert sharp'sr == null' # assert sr is nil 18 18 using sr = File.openText(.fileName) 19 19 print sr.readLine 20 assert $sharp('sr == null')# assert sr is nil20 assert sharp'sr == null' # assert sr is nil 21 21 Test().useClassVar 22 22 23 23 var _tr as TextReader? … … 27 27 using _tr = File.openText(.fileName) 28 28 assert _tr is not nil 29 29 print _tr.readLine 30 assert $sharp('_tr == null')# assert _tr is nil30 assert sharp'_tr == null' # assert _tr is nil -
Developer/IntermediateReleaseNotes.text
469 469 * Fixed: The expression `nil is x`, where `x` is a nilable type, generates a false error message. 470 470 471 471 * Fixed: Only the last `test` of a series of tests is included in the compiler's output. 472 473 * Generate warning on use of deprecated "$sharp('...')" syntax in favor of newer alternate sharp-string-literal form: sharp'...' and sharp"..."