New syntax for property accessors

This commit is contained in:
Andrey Breslav
2010-12-22 19:28:22 +03:00
parent 7547b36eb0
commit cfcb9d7d7d
15 changed files with 487 additions and 363 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ typeParameter
;
typeConstraint
: userType ":" (userType | "this") // "this" for self-type
: userType ":" type
: "class" "object" userType ":" type
// TODO: other constraints, maybe
;
+1 -1
View File
@@ -85,7 +85,7 @@ functionBody
property
: modifiers ("val" | "var") attributes (type ".")? SimpleName (":" type)? ("=" expression)?
"{" getter? setter? "}"
(getter? setter? | setter? getter?)
;
getter
+7 -2
View File
@@ -39,17 +39,22 @@ declaration
;
expressionWithPrecedences // See the precedence table, everything associates to the left
: memberLiteral
: memberAccessExpression
: infixFunctionCall
: binOpExpression
: assignment
: unOpExpression
: castExpression
: typingExpression
: memberAccessExpression
;
memberLiteral
: expression? '#' SimpleName
;
memberAccessExpression
: (expression accessOp)? memberAccess
: (expression accessOp)? (memberAccess | expression)
;
accessOp