Make constructors just methods.

* Eliminate "new" reserved word.
* Allow "this" before a method definition to define a constructor.
* Only create a default constructor for classes that don't define one.
This commit is contained in:
Bob Nystrom
2015-07-10 09:18:22 -07:00
parent 0ddaa2517c
commit 5fb6186d7d
221 changed files with 864 additions and 654 deletions
+4 -4
View File
@@ -28,8 +28,8 @@ Some people like to see all of the reserved words in a programming language in
one lump. If you're one of those folks, here you go:
:::dart
break class else false for foreign if import in is
new null return static super this true var while
break class else false for foreign if import in
is null return static super this true var while
## Identifiers
@@ -102,12 +102,12 @@ compact notation:
:::dart
{ "single expression" }
If there is no newline after the `{` (or after the parameter list in a of
If there is no newline after the `{` (or after the parameter list in a
[function](functions.html)), then the block may only contain a single
expression, and it automatically returns the result of it. It's exactly the
same as doing:
:::dart
{
return "single expression"
return "single expression"
}