Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1551)

Side by Side Diff: sky/specs/script.md

Issue 935113002: Specs: add that we assume library.declarations to be in source order to the list of (currently unwa… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698