| OLD | NEW |
| 1 Sky Script Language | 1 Sky Script Language |
| 2 =================== | 2 =================== |
| 3 | 3 |
| 4 The Sky script language is Dart. | 4 The Sky script language is Dart. |
| 5 | 5 |
| 6 The way that Sky integrates the module system with its script language | 6 The way that Sky integrates the module system with its script language |
| 7 is described in [modules.md](modules.md). | 7 is described in [modules.md](modules.md). |
| 8 | 8 |
| 9 All the APIs defined in this documentation, unless explicitly called | 9 All the APIs defined in this documentation, unless explicitly called |
| 10 out as being in a framework, are in the `dart:sky` built-in module. | 10 out as being in a framework, are in the `dart:sky` built-in module. |
| 11 | 11 |
| 12 When a method in `dart:sky` defined as ``external`` receives an | 12 When a method in `dart:sky` defined as ``external`` receives an |
| 13 argument, it must type-check it, and, if the argument's value is the | 13 argument, it must type-check it, and, if the argument's value is the |
| 14 wrong type, then it must throw an ArgumentError as follows: | 14 wrong type, then it must throw an ArgumentError as follows: |
| 15 | 15 |
| 16 throw new ArgumentError(value, name: name); | 16 throw new ArgumentError(value, name: name); |
| 17 | 17 |
| 18 ...where "name" is the name of the argument. Type checking here | 18 ...where "name" is the name of the argument. Type checking here |
| 19 includes rejecting nulls unless otherwise indicated or unless null is | 19 includes rejecting nulls unless otherwise indicated or unless null is |
| 20 argument's default value. | 20 argument's default value. |
| 21 | 21 |
| 22 The following definitions are exposed in ``dart:sky``: | 22 The following definitions are exposed in ``dart:sky``: |
| 23 | 23 |
| 24 ```dart | 24 ```dart |
| 25 abstract class AutomaticMetadata { | 25 abstract class AutomaticMetadata { |
| 26 const AutomaticMetadata(); | 26 const AutomaticMetadata(); |
| 27 void init(DeclarationMirror target, Module module); | 27 void init(DeclarationMirror target, Module module); |
| 28 | 28 |
| 29 static void runLibrary(LibraryMirror library, Module module) { | 29 static void runLibrary(LibraryMirror library, Module module) { |
| 30 library.declarations.values.toList()..sort((DeclarationMirror a, Declaration
Mirror b) { | 30 library.declarations.values.toList() /* ..sort((DeclarationMirror a, Declara
tionMirror b) { |
| 31 bool aHasLocation; | 31 bool aHasLocation; |
| 32 try { | 32 try { |
| 33 aHasLocation = a.location != null; | 33 aHasLocation = a.location != null; |
| 34 } catch(e) { | 34 } catch(e) { |
| 35 aHasLocation = false; | 35 aHasLocation = false; |
| 36 } | 36 } |
| 37 bool bHasLocation; | 37 bool bHasLocation; |
| 38 try { | 38 try { |
| 39 bHasLocation = b.location != null; | 39 bHasLocation = b.location != null; |
| 40 } catch(e) { | 40 } catch(e) { |
| 41 bHasLocation = false; | 41 bHasLocation = false; |
| 42 } | 42 } |
| 43 if (!aHasLocation) | 43 if (!aHasLocation) |
| 44 return bHasLocation ? 1 : 0; | 44 return bHasLocation ? 1 : 0; |
| 45 if (!bHasLocation) | 45 if (!bHasLocation) |
| 46 return -1; | 46 return -1; |
| 47 if (a.location.sourceUri != b.location.sourceUri) | 47 if (a.location.sourceUri != b.location.sourceUri) |
| 48 return a.location.sourceUri.toString().compareTo(b.location.sourceUri.to
String()); | 48 return a.location.sourceUri.toString().compareTo(b.location.sourceUri.to
String()); |
| 49 if (a.location.line != b.location.line) | 49 if (a.location.line != b.location.line) |
| 50 return a.location.line - b.location.line; | 50 return a.location.line - b.location.line; |
| 51 return a.location.column - b.location.column; | 51 return a.location.column - b.location.column; |
| 52 }) | 52 }) */ |
| 53 ..forEach((DeclarationMirror d) { | 53 ..forEach((DeclarationMirror d) { |
| 54 d.metadata.forEach((InstanceMirror i) { | 54 d.metadata.forEach((InstanceMirror i) { |
| 55 if (i.reflectee is AutomaticMetadata) | 55 if (i.reflectee is AutomaticMetadata) |
| 56 i.reflectee.run(d, module); | 56 i.reflectee.run(d, module); |
| 57 }); | 57 }); |
| 58 }); | 58 }); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 class AutomaticFunction extends AutomaticMetadata { | 62 class AutomaticFunction extends AutomaticMetadata { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 to a superclass' constructor, wherein the subclass' constructor has | 86 to a superclass' constructor, wherein the subclass' constructor has |
| 87 the same arguments as the superclass' constructor and does nothing | 87 the same arguments as the superclass' constructor and does nothing |
| 88 but invoke that superclass' constructor with the same arguments. The | 88 but invoke that superclass' constructor with the same arguments. The |
| 89 syntax for defining this is, within the class body for a class | 89 syntax for defining this is, within the class body for a class |
| 90 called ClassName: | 90 called ClassName: |
| 91 | 91 |
| 92 ```dart | 92 ```dart |
| 93 ClassName = SuperclassName; | 93 ClassName = SuperclassName; |
| 94 ClassName.namedConstructor = SuperclassName.otherNamedConstructor; | 94 ClassName.namedConstructor = SuperclassName.otherNamedConstructor; |
| 95 ``` | 95 ``` |
| 96 |
| 97 * The reflection APIs (`dart:mirrors`) are assumed to reflect a |
| 98 library's declarations in source order. |
| OLD | NEW |