Ticket #279: diff-unused-01.patch
File diff-unused-01.patch, 3.5 KB (added by maboiteaspam, 13 years ago) |
---|
-
CobraParser.cobra
# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/clement/Projects/Cobra-Perso/Source # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process.
1852 1852 identifier = token.value to String 1853 1853 .checkStartsLowercase(identifier, 'Parameter') 1854 1854 dir = Direction.In 1855 declaredAsUnused = false 1855 1856 type as ITypeProxy? 1856 1857 if .optional('AS') 1858 1859 # to detect usage of syntax {AS {UNUSED} {OUT,INOUT} <type>} 1860 if .optional('UNUSED') 1861 declaredAsUnused = true 1862 1857 1863 # code below expresses an undocumented dependency and ordering 1858 1864 # allows only VARI <type> or {OUT,INOUT} <type> 1859 1865 # i.e cant have VARI and {OUT,INOUT}, if have VARI or OUT,INOUT must specify type … … 1882 1888 attribs.add(AttributeDecl(.attribExpr(0))) 1883 1889 # note: isMissingType is currently used to generate a warning in .paramDecls above 1884 1890 # and may be used for anonymous method parameter type inference at some point 1885 return Param(token, type, isMissingType=isMissingType, direction=dir, attributes=attribs)1891 return Param(token, type, isMissingType=isMissingType, direction=dir, isDeclaredAsUnused=declaredAsUnused, attributes=attribs) 1886 1892 1887 1893 1888 1894 ## -
KeywordSpecs.cobra
85 85 'def | declarative: Declare a method.', 86 86 'sig | declarative: Declare a method signature.', 87 87 'as | declarative: Declare the type for an argument, variable, method return, property, etc.', 88 'unused | declarative: Declare the parameter as unused.', 88 89 'get | declarative: Declare property reader/accessor. | expression: The evaluation result on a `for` expression.', 89 90 'set | declarative: Declare property writer/mutator.', 90 91 'pro | declarative: Declare a property.', -
Members.cobra
905 905 if _requirePart, _requirePart.checkConnectToken 906 906 if _ensurePart, _ensurePart.checkConnectToken 907 907 .checkForUnmarkedOverrideOrNew # have to do this after statements bindImp since using base can add `override` 908 .checkForUnusedParams 908 909 .checkForUnusedVariables 909 910 910 911 var _didComputeMatchingBaseMember = true … … 952 953 if not local.isUsed 953 954 .compiler.warning(local, 'The value of variable "[local.name]" is never used.') 954 955 956 def checkForUnusedParams 957 if 'abstract' not in .isNames and .statements.count 958 if not .statements[0] inherits PassStmt 959 for param in _params 960 if not param.isUsed and not param.isOut and not param.isDeclaredAsUnused 961 .compiler.warning(param, 'The value of parameter "[param.name]" is never used in [.parentBox.name].[.name].') 955 962 956 963 ## Generics 957 964 -
Vars.cobra
187 187 In the future, the type may be inferred for an anon method in the context it is used (a specific delegate or event). 188 188 """ 189 189 190 pro isDeclaredAsUnused from var as bool 191 """ 192 Returns true if parameter was declared as unused. 193 """ 194 190 195 pro isAnonymousParam from var as bool 191 196 192 197 pro direction from var as Direction