forked from phoedos/pmd
Update Swift.g4 for swift 4.1
This commit is contained in:
@ -894,11 +894,14 @@ platformCondition
|
||||
: 'os' '(' operatingSystem ')'
|
||||
| 'arch' '(' architecture ')'
|
||||
| 'swift' '(' '>=' swiftVersion ')'
|
||||
| 'canImport' '(' moduleName ')'
|
||||
| 'targetEnvironment' '(' 'simulator' ')'
|
||||
;
|
||||
|
||||
operatingSystem: 'OSX' | 'iOS' | 'watchOS' | 'tvOS' ;
|
||||
architecture: 'i386' | 'x86_64' | 'arm' | 'arm64' ;
|
||||
swiftVersion: FloatingPointLiteral ;
|
||||
moduleName: IdentifierCharacters ;
|
||||
|
||||
lineControlStatement: '#sourceLocation' '(' 'file' ':' fileName ',' 'line' ':' lineNumber ')'
|
||||
| '#sourceLocation' '(' ')' ;
|
||||
|
@ -30,7 +30,7 @@ public class SwiftTokenizerTest extends AbstractTokenizerTest {
|
||||
|
||||
@Test
|
||||
public void tokenizeTest() throws IOException {
|
||||
this.expectedTokenCount = 4217;
|
||||
this.expectedTokenCount = 4239;
|
||||
super.tokenizeTest();
|
||||
}
|
||||
}
|
||||
|
@ -1003,3 +1003,13 @@ class MyClass {
|
||||
let myClass = MyClass()
|
||||
//myClass.delegate = View() // error: cannot assign value of type 'View' to type '(View & MyProtocol)?'
|
||||
myClass.delegate = ViewSubclass()
|
||||
|
||||
// 4.1 conditional
|
||||
|
||||
#if canImport(SomeModule)
|
||||
let someModuleImportedVersion = SomeModule.version
|
||||
#endif
|
||||
|
||||
#if targetEnvironment(simulator)
|
||||
print("code only compiled for simulator")
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user