mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename TypeOfExpr / TypeOfInst to MetatypeExpr / MetatypeInst.
Introduce a '.metatype' form in the syntax and do some basic type-checking that I probably haven't done right. Change IR-generation for that and GetMetatypeExpr to use code that actually honors the dynamic type of an expression. Swift SVN r3053
This commit is contained in:
@@ -233,6 +233,7 @@ NullablePtr<Expr> Parser::parseExprNew() {
|
||||
/// expr-postfix:
|
||||
/// expr-primary
|
||||
/// expr-dot
|
||||
/// expr-metatype
|
||||
/// expr-subscript
|
||||
/// expr-call
|
||||
/// expr-postfix operator-postfix
|
||||
@@ -316,6 +317,12 @@ NullablePtr<Expr> Parser::parseExprPostfix(Diag<> ID) {
|
||||
SourceLoc TokLoc = Tok.getLoc();
|
||||
|
||||
if (consumeIf(tok::period)) {
|
||||
if (Tok.is(tok::kw_metatype)) {
|
||||
SourceLoc metatypeLoc = consumeToken(tok::kw_metatype);
|
||||
Result = new (Context) MetatypeExpr(Result.get(), metatypeLoc, Type());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Tok.isNot(tok::identifier) && Tok.isNot(tok::dollarident)) {
|
||||
diagnose(Tok, diag::expected_field_name);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user