resin 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/amber/css/amber-normalize.css +73 -73
  2. data/amber/css/amber-normalize.less +1 -1
  3. data/amber/css/amber.css +106 -106
  4. data/amber/css/helios.css +242 -0
  5. data/amber/images/hsplitter.png +0 -0
  6. data/amber/images/vsplitter.png +0 -0
  7. data/amber/js/Benchfib.deploy.js +116 -38
  8. data/amber/js/Benchfib.js +120 -42
  9. data/amber/js/Canvas.deploy.js +674 -403
  10. data/amber/js/Canvas.js +682 -411
  11. data/amber/js/Compiler-AST.deploy.js +1150 -0
  12. data/amber/js/Compiler-AST.js +1591 -0
  13. data/amber/js/Compiler-Core.deploy.js +1562 -0
  14. data/amber/js/Compiler-Core.js +1972 -0
  15. data/amber/js/Compiler-Exceptions.deploy.js +114 -0
  16. data/amber/js/Compiler-Exceptions.js +161 -0
  17. data/amber/js/Compiler-IR.deploy.js +2326 -0
  18. data/amber/js/Compiler-IR.js +3146 -0
  19. data/amber/js/Compiler-Inlining.deploy.js +1147 -0
  20. data/amber/js/Compiler-Inlining.js +1514 -0
  21. data/amber/js/Compiler-Semantic.deploy.js +1207 -0
  22. data/amber/js/Compiler-Semantic.js +1628 -0
  23. data/amber/js/Compiler-Tests.deploy.js +646 -60
  24. data/amber/js/Compiler-Tests.js +843 -82
  25. data/amber/js/Compiler.deploy.js +1097 -159
  26. data/amber/js/Compiler.js +1414 -161
  27. data/amber/js/Examples.deploy.js +31 -15
  28. data/amber/js/Examples.js +33 -17
  29. data/amber/js/Helios-Announcements.deploy.js +127 -0
  30. data/amber/js/Helios-Announcements.js +157 -0
  31. data/amber/js/Helios-Browser.deploy.js +1473 -0
  32. data/amber/js/Helios-Browser.js +1953 -0
  33. data/amber/js/Helios-Commands.deploy.js +403 -0
  34. data/amber/js/Helios-Commands.js +563 -0
  35. data/amber/js/Helios-Core.deploy.js +1070 -0
  36. data/amber/js/Helios-Core.js +1445 -0
  37. data/amber/js/Helios-Environments.deploy.js +132 -0
  38. data/amber/js/Helios-Environments.js +179 -0
  39. data/amber/js/Helios-Inspector.deploy.js +855 -0
  40. data/amber/js/Helios-Inspector.js +1155 -0
  41. data/amber/js/Helios-KeyBindings.deploy.js +753 -0
  42. data/amber/js/Helios-KeyBindings.js +1023 -0
  43. data/amber/js/Helios-Layout.deploy.js +383 -0
  44. data/amber/js/Helios-Layout.js +523 -0
  45. data/amber/js/Helios-Workspace.deploy.js +799 -0
  46. data/amber/js/Helios-Workspace.js +1074 -0
  47. data/amber/js/IDE.deploy.js +2541 -1490
  48. data/amber/js/IDE.js +2721 -1660
  49. data/amber/js/Importer-Exporter.deploy.js +671 -0
  50. data/amber/js/Importer-Exporter.js +816 -0
  51. data/amber/js/Kernel-Announcements.deploy.js +137 -20
  52. data/amber/js/Kernel-Announcements.js +176 -22
  53. data/amber/js/Kernel-Classes.deploy.js +555 -168
  54. data/amber/js/Kernel-Classes.js +662 -205
  55. data/amber/js/Kernel-Collections.deploy.js +1403 -618
  56. data/amber/js/Kernel-Collections.js +1545 -690
  57. data/amber/js/Kernel-Exceptions.deploy.js +109 -45
  58. data/amber/js/Kernel-Exceptions.js +123 -49
  59. data/amber/js/Kernel-Methods.deploy.js +196 -81
  60. data/amber/js/Kernel-Methods.js +214 -89
  61. data/amber/js/Kernel-Objects.deploy.js +1542 -1117
  62. data/amber/js/Kernel-Objects.js +1593 -1148
  63. data/amber/js/Kernel-Tests.deploy.js +1725 -772
  64. data/amber/js/Kernel-Tests.js +2301 -1123
  65. data/amber/js/Kernel-Transcript.deploy.js +23 -25
  66. data/amber/js/Kernel-Transcript.js +24 -26
  67. data/amber/js/SUnit.deploy.js +204 -131
  68. data/amber/js/SUnit.js +222 -139
  69. data/amber/js/Spaces.deploy.js +240 -0
  70. data/amber/js/Spaces.js +326 -0
  71. data/amber/js/amber.js +26 -7
  72. data/amber/js/boot.js +65 -47
  73. data/amber/js/init.js +1 -1
  74. data/amber/js/lib/CodeMirror/amber.css +21 -21
  75. data/amber/js/lib/CodeMirror/codemirror.css +119 -13
  76. data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
  77. data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
  78. data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
  79. data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
  80. data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  81. data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  82. data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
  83. data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
  84. data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
  85. data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
  86. data/amber/st/Compiler-AST.st +505 -0
  87. data/amber/st/Compiler-Core.st +835 -0
  88. data/amber/st/Compiler-Exceptions.st +87 -0
  89. data/amber/st/Compiler-IR.st +1097 -0
  90. data/amber/st/Compiler-Inlining.st +650 -0
  91. data/amber/st/Compiler-Semantic.st +558 -0
  92. data/amber/st/Compiler-Tests.st +285 -381
  93. data/amber/st/Compiler.st +725 -2
  94. data/amber/st/Helios-Announcements.st +104 -0
  95. data/amber/st/Helios-Browser.st +708 -0
  96. data/amber/st/Helios-Commands.st +223 -0
  97. data/amber/st/Helios-Core.st +532 -0
  98. data/amber/st/Helios-Environments.st +98 -0
  99. data/amber/st/Helios-Inspector.st +367 -0
  100. data/amber/st/Helios-KeyBindings.st +337 -0
  101. data/amber/st/Helios-Layout.st +199 -0
  102. data/amber/st/Helios-Workspace.st +367 -0
  103. data/amber/st/IDE.st +75 -53
  104. data/amber/st/Importer-Exporter.st +386 -0
  105. data/amber/st/Kernel-Announcements.st +92 -0
  106. data/amber/st/Kernel-Classes.st +137 -15
  107. data/amber/st/Kernel-Collections.st +137 -47
  108. data/amber/st/Kernel-Exceptions.st +14 -0
  109. data/amber/st/Kernel-Methods.st +9 -1
  110. data/amber/st/Kernel-Objects.st +29 -5
  111. data/amber/st/Kernel-Tests.st +545 -199
  112. data/amber/st/SUnit.st +10 -0
  113. data/amber/st/Spaces.st +142 -0
  114. data/lib/resin/app.rb +1 -1
  115. metadata +86 -31
  116. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
  117. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
@@ -0,0 +1,816 @@
1
+ smalltalk.addPackage('Importer-Exporter', {});
2
+ smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
3
+ smalltalk.addMethod(
4
+ "_nextChunk",
5
+ smalltalk.method({
6
+ selector: "nextChunk",
7
+ category: 'reading',
8
+ fn: function (){
9
+ var self=this;
10
+ var $1,$2,$3;
11
+ var $early={};
12
+ try {
13
+ var char_;
14
+ var result;
15
+ var chunk;
16
+ result=smalltalk.send("","_writeStream",[]);
17
+ smalltalk.send((function(){
18
+ char_=smalltalk.send(self["@stream"],"_next",[]);
19
+ char_;
20
+ return smalltalk.send(char_,"_notNil",[]);
21
+ }),"_whileTrue_",[(function(){
22
+ $1=smalltalk.send(char_,"__eq",["!"]);
23
+ if(smalltalk.assert($1)){
24
+ $2=smalltalk.send(smalltalk.send(self["@stream"],"_peek",[]),"__eq",["!"]);
25
+ if(smalltalk.assert($2)){
26
+ smalltalk.send(self["@stream"],"_next",[]);
27
+ } else {
28
+ $3=smalltalk.send(smalltalk.send(result,"_contents",[]),"_trimBoth",[]);
29
+ throw $early=[$3];
30
+ };
31
+ };
32
+ return smalltalk.send(result,"_nextPut_",[char_]);
33
+ })]);
34
+ return nil;
35
+ }
36
+ catch(e) {if(e===$early)return e[0]; throw e}
37
+ },
38
+ args: [],
39
+ source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a [char := stream next.\x0a char notNil] whileTrue: [\x0a char = '!' ifTrue: [\x0a stream peek = '!'\x0a ifTrue: [stream next \x22skipping the escape double\x22]\x0a ifFalse: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
40
+ messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"],
41
+ referencedClasses: []
42
+ }),
43
+ smalltalk.ChunkParser);
44
+
45
+ smalltalk.addMethod(
46
+ "_stream_",
47
+ smalltalk.method({
48
+ selector: "stream:",
49
+ category: 'accessing',
50
+ fn: function (aStream){
51
+ var self=this;
52
+ self["@stream"]=aStream;
53
+ return self},
54
+ args: ["aStream"],
55
+ source: "stream: aStream\x0a\x09stream := aStream",
56
+ messageSends: [],
57
+ referencedClasses: []
58
+ }),
59
+ smalltalk.ChunkParser);
60
+
61
+
62
+ smalltalk.addMethod(
63
+ "_on_",
64
+ smalltalk.method({
65
+ selector: "on:",
66
+ category: 'not yet classified',
67
+ fn: function (aStream){
68
+ var self=this;
69
+ var $1;
70
+ $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_stream_",[aStream]);
71
+ return $1;
72
+ },
73
+ args: ["aStream"],
74
+ source: "on: aStream\x0a\x09^self new stream: aStream",
75
+ messageSends: ["stream:", "new"],
76
+ referencedClasses: []
77
+ }),
78
+ smalltalk.ChunkParser.klass);
79
+
80
+
81
+ smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
82
+ smalltalk.addMethod(
83
+ "_classNameFor_",
84
+ smalltalk.method({
85
+ selector: "classNameFor:",
86
+ category: 'private',
87
+ fn: function (aClass){
88
+ var self=this;
89
+ var $2,$3,$1;
90
+ $2=smalltalk.send(aClass,"_isMetaclass",[]);
91
+ if(smalltalk.assert($2)){
92
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
93
+ } else {
94
+ $3=smalltalk.send(aClass,"_isNil",[]);
95
+ if(smalltalk.assert($3)){
96
+ $1="nil";
97
+ } else {
98
+ $1=smalltalk.send(aClass,"_name",[]);
99
+ };
100
+ };
101
+ return $1;
102
+ },
103
+ args: ["aClass"],
104
+ source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, '.klass']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
105
+ messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
106
+ referencedClasses: []
107
+ }),
108
+ smalltalk.Exporter);
109
+
110
+ smalltalk.addMethod(
111
+ "_exportAll",
112
+ smalltalk.method({
113
+ selector: "exportAll",
114
+ category: 'fileOut',
115
+ fn: function (){
116
+ var self=this;
117
+ var $1;
118
+ $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
119
+ return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packages",[]),"_do_",[(function(pkg){
120
+ return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportPackage_",[smalltalk.send(pkg,"_name",[])])]);
121
+ })]);
122
+ })]);
123
+ return $1;
124
+ },
125
+ args: [],
126
+ source: "exportAll\x0a \x22Export all packages in the system.\x22\x0a\x0a ^String streamContents: [:stream |\x0a \x09Smalltalk current packages do: [:pkg |\x0a\x09\x09stream nextPutAll: (self exportPackage: pkg name)]]",
127
+ messageSends: ["streamContents:", "do:", "nextPutAll:", "exportPackage:", "name", "packages", "current"],
128
+ referencedClasses: ["Smalltalk", "String"]
129
+ }),
130
+ smalltalk.Exporter);
131
+
132
+ smalltalk.addMethod(
133
+ "_exportClass_",
134
+ smalltalk.method({
135
+ selector: "exportClass:",
136
+ category: 'fileOut',
137
+ fn: function (aClass){
138
+ var self=this;
139
+ var $1;
140
+ $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
141
+ smalltalk.send(self,"_exportDefinitionOf_on_",[aClass,stream]);
142
+ smalltalk.send(self,"_exportMethodsOf_on_",[aClass,stream]);
143
+ smalltalk.send(self,"_exportMetaDefinitionOf_on_",[aClass,stream]);
144
+ return smalltalk.send(self,"_exportMethodsOf_on_",[smalltalk.send(aClass,"_class",[]),stream]);
145
+ })]);
146
+ return $1;
147
+ },
148
+ args: ["aClass"],
149
+ source: "exportClass: aClass\x0a\x09\x22Export a single class. Subclasses override these methods.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09self exportDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass on: stream.\x0a\x09\x09self exportMetaDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass class on: stream]",
150
+ messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"],
151
+ referencedClasses: ["String"]
152
+ }),
153
+ smalltalk.Exporter);
154
+
155
+ smalltalk.addMethod(
156
+ "_exportDefinitionOf_on_",
157
+ smalltalk.method({
158
+ selector: "exportDefinitionOf:on:",
159
+ category: 'private',
160
+ fn: function (aClass,aStream){
161
+ var self=this;
162
+ var $1,$2,$3,$4;
163
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
164
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
165
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
166
+ $1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
167
+ smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
168
+ return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
169
+ }),(function(){
170
+ return smalltalk.send(aStream,"_nextPutAll_",[", "]);
171
+ })]);
172
+ smalltalk.send(aStream,"_nextPutAll_",["], '"]);
173
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
174
+ $2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
175
+ $3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
176
+ if(smalltalk.assert($3)){
177
+ smalltalk.send(aStream,"_lf",[]);
178
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk."]);
179
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[aClass])]);
180
+ smalltalk.send(aStream,"_nextPutAll_",[".comment="]);
181
+ $4=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_asJavascript",[])]);
182
+ $4;
183
+ };
184
+ smalltalk.send(aStream,"_lf",[]);
185
+ return self},
186
+ args: ["aClass", "aStream"],
187
+ source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addClass(';\x0a\x09 nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09 nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09 nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09 do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09 separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09 nextPutAll: '], ''';\x0a\x09 nextPutAll: aClass category, '''';\x0a\x09 nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09 aStream \x0a\x09 \x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript].\x0a\x09aStream lf",
188
+ messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"],
189
+ referencedClasses: []
190
+ }),
191
+ smalltalk.Exporter);
192
+
193
+ smalltalk.addMethod(
194
+ "_exportMetaDefinitionOf_on_",
195
+ smalltalk.method({
196
+ selector: "exportMetaDefinitionOf:on:",
197
+ category: 'private',
198
+ fn: function (aClass,aStream){
199
+ var self=this;
200
+ var $1,$2;
201
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
202
+ if(! smalltalk.assert($1)){
203
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])])]);
204
+ $2=smalltalk.send(aStream,"_nextPutAll_",[".iVarNames = ["]);
205
+ $2;
206
+ smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
207
+ return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
208
+ }),(function(){
209
+ return smalltalk.send(aStream,"_nextPutAll_",[","]);
210
+ })]);
211
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("];","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])])]);
212
+ };
213
+ return self},
214
+ args: ["aClass", "aStream"],
215
+ source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09 aStream \x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09 aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09 aStream nextPutAll: '];', String lf]",
216
+ messageSends: ["ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
217
+ referencedClasses: ["String"]
218
+ }),
219
+ smalltalk.Exporter);
220
+
221
+ smalltalk.addMethod(
222
+ "_exportMethod_of_on_",
223
+ smalltalk.method({
224
+ selector: "exportMethod:of:on:",
225
+ category: 'private',
226
+ fn: function (aMethod,aClass,aStream){
227
+ var self=this;
228
+ var $1,$2;
229
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
230
+ smalltalk.send(aStream,"_lf",[]);
231
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
232
+ smalltalk.send(aStream,"_lf",[]);
233
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
234
+ smalltalk.send(aStream,"_lf",[]);
235
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
236
+ smalltalk.send(aStream,"_lf",[]);
237
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("category: '","__comma",[smalltalk.send(aMethod,"_category",[])]),"__comma",["',"])]);
238
+ smalltalk.send(aStream,"_lf",[]);
239
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])]),"__comma",[","])]);
240
+ smalltalk.send(aStream,"_lf",[]);
241
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_asJavascript",[])]),"__comma",[","])]);
242
+ smalltalk.send(aStream,"_lf",[]);
243
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
244
+ smalltalk.send(aStream,"_lf",[]);
245
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("messageSends: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asJavascript",[])]),"__comma",[","])]);
246
+ smalltalk.send(aStream,"_lf",[]);
247
+ $1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("referencedClasses: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_referencedClasses",[]),"_asJavascript",[])])]);
248
+ smalltalk.send(aStream,"_lf",[]);
249
+ smalltalk.send(aStream,"_nextPutAll_",["}),"]);
250
+ smalltalk.send(aStream,"_lf",[]);
251
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
252
+ smalltalk.send(aStream,"_nextPutAll_",[");"]);
253
+ smalltalk.send(aStream,"_lf",[]);
254
+ $2=smalltalk.send(aStream,"_lf",[]);
255
+ return self},
256
+ args: ["aMethod", "aClass", "aStream"],
257
+ source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
258
+ messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"],
259
+ referencedClasses: []
260
+ }),
261
+ smalltalk.Exporter);
262
+
263
+ smalltalk.addMethod(
264
+ "_exportMethodsOf_on_",
265
+ smalltalk.method({
266
+ selector: "exportMethodsOf:on:",
267
+ category: 'private',
268
+ fn: function (aClass,aStream){
269
+ var self=this;
270
+ var $1;
271
+ smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
272
+ return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
273
+ })]),"_do_",[(function(each){
274
+ $1=smalltalk.send(smalltalk.send(each,"_category",[]),"_match_",["^\x5c*"]);
275
+ if(! smalltalk.assert($1)){
276
+ return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
277
+ };
278
+ })]);
279
+ smalltalk.send(aStream,"_lf",[]);
280
+ return self},
281
+ args: ["aClass", "aStream"],
282
+ source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09(each category match: '^\x5c*') ifFalse: [\x0a\x09\x09\x09self exportMethod: each of: aClass on: aStream]].\x0a\x09aStream lf",
283
+ messageSends: ["do:", "ifFalse:", "exportMethod:of:on:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "lf"],
284
+ referencedClasses: []
285
+ }),
286
+ smalltalk.Exporter);
287
+
288
+ smalltalk.addMethod(
289
+ "_exportPackage_",
290
+ smalltalk.method({
291
+ selector: "exportPackage:",
292
+ category: 'fileOut',
293
+ fn: function (packageName){
294
+ var self=this;
295
+ var $1;
296
+ var package;
297
+ $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
298
+ package=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packageAt_",[packageName]);
299
+ package;
300
+ smalltalk.send(self,"_exportPackageDefinitionOf_on_",[package,stream]);
301
+ smalltalk.send(smalltalk.send(smalltalk.send(package,"_sortedClasses",[]),"_asSet",[]),"_do_",[(function(each){
302
+ return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportClass_",[each])]);
303
+ })]);
304
+ return smalltalk.send(self,"_exportPackageExtensionsOf_on_",[package,stream]);
305
+ })]);
306
+ return $1;
307
+ },
308
+ args: ["packageName"],
309
+ source: "exportPackage: packageName\x0a\x09\x22Export a given package by name.\x22\x0a\x0a\x09| package |\x0a\x09^String streamContents: [:stream |\x0a package := Smalltalk current packageAt: packageName.\x0a self exportPackageDefinitionOf: package on: stream.\x0a\x0a\x09\x09\x22Export classes in dependency order.\x0a\x09\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09 \x09package sortedClasses asSet do: [:each |\x0a stream nextPutAll: (self exportClass: each)].\x0a\x09\x09self exportPackageExtensionsOf: package on: stream]",
310
+ messageSends: ["streamContents:", "packageAt:", "current", "exportPackageDefinitionOf:on:", "do:", "nextPutAll:", "exportClass:", "asSet", "sortedClasses", "exportPackageExtensionsOf:on:"],
311
+ referencedClasses: ["Smalltalk", "String"]
312
+ }),
313
+ smalltalk.Exporter);
314
+
315
+ smalltalk.addMethod(
316
+ "_exportPackageDefinitionOf_on_",
317
+ smalltalk.method({
318
+ selector: "exportPackageDefinitionOf:on:",
319
+ category: 'private',
320
+ fn: function (package,aStream){
321
+ var self=this;
322
+ var $1;
323
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addPackage("]);
324
+ $1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["', "]),"__comma",[smalltalk.send(package,"_propertiesAsJSON",[])]),"__comma",[");"])]);
325
+ smalltalk.send(aStream,"_lf",[]);
326
+ return self},
327
+ args: ["package", "aStream"],
328
+ source: "exportPackageDefinitionOf: package on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addPackage(';\x0a\x09 nextPutAll: '''', package name, ''', ', package propertiesAsJSON , ');'.\x0a\x09aStream lf",
329
+ messageSends: ["nextPutAll:", ",", "propertiesAsJSON", "name", "lf"],
330
+ referencedClasses: []
331
+ }),
332
+ smalltalk.Exporter);
333
+
334
+ smalltalk.addMethod(
335
+ "_exportPackageExtensionsOf_on_",
336
+ smalltalk.method({
337
+ selector: "exportPackageExtensionsOf:on:",
338
+ category: 'private',
339
+ fn: function (package,aStream){
340
+ var self=this;
341
+ var $1;
342
+ var name;
343
+ name=smalltalk.send(package,"_name",[]);
344
+ smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
345
+ return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
346
+ return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
347
+ return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
348
+ })]),"_do_",[(function(method){
349
+ $1=smalltalk.send(smalltalk.send(method,"_category",[]),"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
350
+ if(smalltalk.assert($1)){
351
+ return smalltalk.send(self,"_exportMethod_of_on_",[method,aClass,aStream]);
352
+ };
353
+ })]);
354
+ })]);
355
+ })]);
356
+ return self},
357
+ args: ["package", "aStream"],
358
+ source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass | \x0a\x09\x09\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |\x0a\x09\x09\x09\x09(method category match: '^\x5c*', name) ifTrue: [\x0a\x09\x09\x09\x09\x09self exportMethod: method of: aClass on: aStream ]]]]",
359
+ messageSends: ["name", "do:", "ifTrue:", "exportMethod:of:on:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"],
360
+ referencedClasses: ["Smalltalk", "Package"]
361
+ }),
362
+ smalltalk.Exporter);
363
+
364
+
365
+
366
+ smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
367
+ smalltalk.addMethod(
368
+ "_chunkEscape_",
369
+ smalltalk.method({
370
+ selector: "chunkEscape:",
371
+ category: 'not yet classified',
372
+ fn: function (aString){
373
+ var self=this;
374
+ var $1;
375
+ $1=smalltalk.send(smalltalk.send(aString,"_replace_with_",["!","!!"]),"_trimBoth",[]);
376
+ return $1;
377
+ },
378
+ args: ["aString"],
379
+ source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
380
+ messageSends: ["trimBoth", "replace:with:"],
381
+ referencedClasses: []
382
+ }),
383
+ smalltalk.ChunkExporter);
384
+
385
+ smalltalk.addMethod(
386
+ "_classNameFor_",
387
+ smalltalk.method({
388
+ selector: "classNameFor:",
389
+ category: 'not yet classified',
390
+ fn: function (aClass){
391
+ var self=this;
392
+ var $2,$3,$1;
393
+ $2=smalltalk.send(aClass,"_isMetaclass",[]);
394
+ if(smalltalk.assert($2)){
395
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
396
+ } else {
397
+ $3=smalltalk.send(aClass,"_isNil",[]);
398
+ if(smalltalk.assert($3)){
399
+ $1="nil";
400
+ } else {
401
+ $1=smalltalk.send(aClass,"_name",[]);
402
+ };
403
+ };
404
+ return $1;
405
+ },
406
+ args: ["aClass"],
407
+ source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, ' class']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
408
+ messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
409
+ referencedClasses: []
410
+ }),
411
+ smalltalk.ChunkExporter);
412
+
413
+ smalltalk.addMethod(
414
+ "_exportDefinitionOf_on_",
415
+ smalltalk.method({
416
+ selector: "exportDefinitionOf:on:",
417
+ category: 'not yet classified',
418
+ fn: function (aClass,aStream){
419
+ var self=this;
420
+ var $1,$2,$3,$4;
421
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])]);
422
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(" subclass: #","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
423
+ smalltalk.send(aStream,"_lf",[]);
424
+ $1=smalltalk.send(aStream,"_nextPutAll_",["\x09instanceVariableNames: '"]);
425
+ smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
426
+ return smalltalk.send(aStream,"_nextPutAll_",[each]);
427
+ }),(function(){
428
+ return smalltalk.send(aStream,"_nextPutAll_",[" "]);
429
+ })]);
430
+ smalltalk.send(aStream,"_nextPutAll_",["'"]);
431
+ smalltalk.send(aStream,"_lf",[]);
432
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("\x09package: '","__comma",[smalltalk.send(aClass,"_category",[])]),"__comma",["'!"])]);
433
+ $2=smalltalk.send(aStream,"_lf",[]);
434
+ $3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
435
+ if(smalltalk.assert($3)){
436
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",[" commentStamp!"])]);
437
+ smalltalk.send(aStream,"_lf",[]);
438
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aClass,"_comment",[])]),"__comma",["!"])]);
439
+ $4=smalltalk.send(aStream,"_lf",[]);
440
+ $4;
441
+ };
442
+ smalltalk.send(aStream,"_lf",[]);
443
+ return self},
444
+ args: ["aClass", "aStream"],
445
+ source: "exportDefinitionOf: aClass on: aStream\x0a \x22Chunk format.\x22\x0a\x0a aStream \x0a nextPutAll: (self classNameFor: aClass superclass);\x0a nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a nextPutAll: '\x09instanceVariableNames: '''.\x0a aClass instanceVariableNames \x0a do: [:each | aStream nextPutAll: each]\x0a separatedBy: [aStream nextPutAll: ' '].\x0a aStream \x0a nextPutAll: ''''; lf;\x0a nextPutAll: '\x09package: ''', aClass category, '''!'; lf.\x0a aClass comment notEmpty ifTrue: [\x0a aStream \x0a nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a nextPutAll: (self chunkEscape: aClass comment), '!';lf].\x0a aStream lf",
446
+ messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"],
447
+ referencedClasses: []
448
+ }),
449
+ smalltalk.ChunkExporter);
450
+
451
+ smalltalk.addMethod(
452
+ "_exportMetaDefinitionOf_on_",
453
+ smalltalk.method({
454
+ selector: "exportMetaDefinitionOf:on:",
455
+ category: 'not yet classified',
456
+ fn: function (aClass,aStream){
457
+ var self=this;
458
+ var $1,$2,$3;
459
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
460
+ if(! smalltalk.assert($1)){
461
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])]);
462
+ $2=smalltalk.send(aStream,"_nextPutAll_",[" instanceVariableNames: '"]);
463
+ $2;
464
+ smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
465
+ return smalltalk.send(aStream,"_nextPutAll_",[each]);
466
+ }),(function(){
467
+ return smalltalk.send(aStream,"_nextPutAll_",[" "]);
468
+ })]);
469
+ smalltalk.send(aStream,"_nextPutAll_",["'!"]);
470
+ smalltalk.send(aStream,"_lf",[]);
471
+ $3=smalltalk.send(aStream,"_lf",[]);
472
+ $3;
473
+ };
474
+ return self},
475
+ args: ["aClass", "aStream"],
476
+ source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream \x0a\x09\x09 nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09 nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames \x0a\x09\x09 do: [:each | aStream nextPutAll: each]\x0a\x09\x09 separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream\x09\x0a\x09\x09 nextPutAll: '''!'; lf; lf]",
477
+ messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
478
+ referencedClasses: []
479
+ }),
480
+ smalltalk.ChunkExporter);
481
+
482
+ smalltalk.addMethod(
483
+ "_exportMethod_of_on_",
484
+ smalltalk.method({
485
+ selector: "exportMethod:of:on:",
486
+ category: 'not yet classified',
487
+ fn: function (aMethod,aClass,aStream){
488
+ var self=this;
489
+ var $1;
490
+ smalltalk.send(aStream,"_lf",[]);
491
+ smalltalk.send(aStream,"_lf",[]);
492
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aMethod,"_source",[])])]);
493
+ smalltalk.send(aStream,"_lf",[]);
494
+ $1=smalltalk.send(aStream,"_nextPutAll_",["!"]);
495
+ return self},
496
+ args: ["aMethod", "aClass", "aStream"],
497
+ source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
498
+ messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
499
+ referencedClasses: []
500
+ }),
501
+ smalltalk.ChunkExporter);
502
+
503
+ smalltalk.addMethod(
504
+ "_exportMethods_category_of_on_",
505
+ smalltalk.method({
506
+ selector: "exportMethods:category:of:on:",
507
+ category: 'not yet classified',
508
+ fn: function (methods,category,aClass,aStream){
509
+ var self=this;
510
+ var $1,$2;
511
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
512
+ $1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(" methodsFor: '","__comma",[category]),"__comma",["'!"])]);
513
+ smalltalk.send(smalltalk.send(methods,"_sorted_",[(function(a,b){
514
+ return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
515
+ })]),"_do_",[(function(each){
516
+ return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
517
+ })]);
518
+ smalltalk.send(aStream,"_nextPutAll_",[" !"]);
519
+ smalltalk.send(aStream,"_lf",[]);
520
+ $2=smalltalk.send(aStream,"_lf",[]);
521
+ return self},
522
+ args: ["methods", "category", "aClass", "aStream"],
523
+ source: "exportMethods: methods category: category of: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category, '''!'.\x0a\x09\x09(methods sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09\x09\x09self exportMethod: each of: aClass on: aStream].\x0a\x09aStream nextPutAll: ' !'; lf; lf",
524
+ messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"],
525
+ referencedClasses: []
526
+ }),
527
+ smalltalk.ChunkExporter);
528
+
529
+ smalltalk.addMethod(
530
+ "_exportMethodsOf_on_",
531
+ smalltalk.method({
532
+ selector: "exportMethodsOf:on:",
533
+ category: 'not yet classified',
534
+ fn: function (aClass,aStream){
535
+ var self=this;
536
+ var $1;
537
+ var map;
538
+ map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
539
+ smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
540
+ $1=smalltalk.send(category,"_match_",["^\x5c*"]);
541
+ if(! smalltalk.assert($1)){
542
+ return smalltalk.send(map,"_at_put_",[category,methods]);
543
+ };
544
+ })]);
545
+ smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
546
+ return smalltalk.send(a,"__lt_eq",[b]);
547
+ })]),"_do_",[(function(category){
548
+ var methods;
549
+ methods=smalltalk.send(map,"_at_",[category]);
550
+ methods;
551
+ return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
552
+ })]);
553
+ return self},
554
+ args: ["aClass", "aStream"],
555
+ source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods | \x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09methods := map at: category.\x0a\x09\x09self\x0a\x09\x09\x09exportMethods: methods\x0a\x09\x09\x09category: category\x0a\x09\x09\x09of: aClass\x0a\x09\x09\x09on: aStream ]",
556
+ messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"],
557
+ referencedClasses: ["Dictionary"]
558
+ }),
559
+ smalltalk.ChunkExporter);
560
+
561
+ smalltalk.addMethod(
562
+ "_exportPackageDefinitionOf_on_",
563
+ smalltalk.method({
564
+ selector: "exportPackageDefinitionOf:on:",
565
+ category: 'not yet classified',
566
+ fn: function (package,aStream){
567
+ var self=this;
568
+ var $1;
569
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Smalltalk current createPackage: '","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["' properties: "]),"__comma",[smalltalk.send(smalltalk.send(package,"_properties",[]),"_storeString",[])]),"__comma",["!"])]);
570
+ $1=smalltalk.send(aStream,"_lf",[]);
571
+ return self},
572
+ args: ["package", "aStream"],
573
+ source: "exportPackageDefinitionOf: package on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream \x0a\x09 nextPutAll: 'Smalltalk current createPackage: ''', package name,\x0a\x09\x09''' properties: ', package properties storeString, '!'; lf.",
574
+ messageSends: ["nextPutAll:", ",", "storeString", "properties", "name", "lf"],
575
+ referencedClasses: []
576
+ }),
577
+ smalltalk.ChunkExporter);
578
+
579
+ smalltalk.addMethod(
580
+ "_exportPackageExtensionsOf_on_",
581
+ smalltalk.method({
582
+ selector: "exportPackageExtensionsOf:on:",
583
+ category: 'not yet classified',
584
+ fn: function (package,aStream){
585
+ var self=this;
586
+ var $1;
587
+ var name;
588
+ var map;
589
+ name=smalltalk.send(package,"_name",[]);
590
+ smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
591
+ return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
592
+ map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
593
+ map;
594
+ smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
595
+ $1=smalltalk.send(category,"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
596
+ if(smalltalk.assert($1)){
597
+ return smalltalk.send(map,"_at_put_",[category,methods]);
598
+ };
599
+ })]);
600
+ return smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
601
+ return smalltalk.send(a,"__lt_eq",[b]);
602
+ })]),"_do_",[(function(category){
603
+ var methods;
604
+ methods=smalltalk.send(map,"_at_",[category]);
605
+ methods;
606
+ return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
607
+ })]);
608
+ })]);
609
+ })]);
610
+ return self},
611
+ args: ["package", "aStream"],
612
+ source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22We need to override this one too since we need to group\x0a\x09all methods in a given protocol under a leading methodsFor: chunk\x0a\x09for that class.\x22\x0a\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods | \x0a\x09\x09\x09\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09\x09\x09methods := map at: category.\x09\x0a\x09\x09\x09\x09self exportMethods: methods category: category of: aClass on: aStream ]]]",
613
+ messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
614
+ referencedClasses: ["Dictionary", "Smalltalk", "Package"]
615
+ }),
616
+ smalltalk.ChunkExporter);
617
+
618
+
619
+
620
+ smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
621
+ smalltalk.addMethod(
622
+ "_exportDefinitionOf_on_",
623
+ smalltalk.method({
624
+ selector: "exportDefinitionOf:on:",
625
+ category: 'private',
626
+ fn: function (aClass,aStream){
627
+ var self=this;
628
+ var $1,$2;
629
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
630
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
631
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
632
+ $1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
633
+ smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
634
+ return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
635
+ }),(function(){
636
+ return smalltalk.send(aStream,"_nextPutAll_",[", "]);
637
+ })]);
638
+ smalltalk.send(aStream,"_nextPutAll_",["], '"]);
639
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
640
+ $2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
641
+ smalltalk.send(aStream,"_lf",[]);
642
+ return self},
643
+ args: ["aClass", "aStream"],
644
+ source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addClass(';\x0a\x09 nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09 nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09 nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09 do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09 separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09 nextPutAll: '], ''';\x0a\x09 nextPutAll: aClass category, '''';\x0a\x09 nextPutAll: ');'.\x0a\x09aStream lf",
645
+ messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"],
646
+ referencedClasses: []
647
+ }),
648
+ smalltalk.StrippedExporter);
649
+
650
+ smalltalk.addMethod(
651
+ "_exportMethod_of_on_",
652
+ smalltalk.method({
653
+ selector: "exportMethod:of:on:",
654
+ category: 'private',
655
+ fn: function (aMethod,aClass,aStream){
656
+ var self=this;
657
+ var $1;
658
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
659
+ smalltalk.send(aStream,"_lf",[]);
660
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
661
+ smalltalk.send(aStream,"_lf",[]);
662
+ smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
663
+ smalltalk.send(aStream,"_lf",[]);
664
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
665
+ smalltalk.send(aStream,"_lf",[]);
666
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])])]);
667
+ smalltalk.send(aStream,"_lf",[]);
668
+ smalltalk.send(aStream,"_nextPutAll_",["}),"]);
669
+ smalltalk.send(aStream,"_lf",[]);
670
+ smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
671
+ smalltalk.send(aStream,"_nextPutAll_",[");"]);
672
+ smalltalk.send(aStream,"_lf",[]);
673
+ $1=smalltalk.send(aStream,"_lf",[]);
674
+ return self},
675
+ args: ["aMethod", "aClass", "aStream"],
676
+ source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
677
+ messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "compiledSource", "fn", "classNameFor:"],
678
+ referencedClasses: []
679
+ }),
680
+ smalltalk.StrippedExporter);
681
+
682
+
683
+
684
+ smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
685
+ smalltalk.addMethod(
686
+ "_import_",
687
+ smalltalk.method({
688
+ selector: "import:",
689
+ category: 'fileIn',
690
+ fn: function (aStream){
691
+ var self=this;
692
+ var $1;
693
+ var chunk;
694
+ var result;
695
+ var parser;
696
+ var lastEmpty;
697
+ parser=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_on_",[aStream]);
698
+ lastEmpty=false;
699
+ smalltalk.send((function(){
700
+ chunk=smalltalk.send(parser,"_nextChunk",[]);
701
+ chunk;
702
+ return smalltalk.send(chunk,"_isNil",[]);
703
+ }),"_whileFalse_",[(function(){
704
+ $1=smalltalk.send(chunk,"_isEmpty",[]);
705
+ if(smalltalk.assert($1)){
706
+ lastEmpty=true;
707
+ return lastEmpty;
708
+ } else {
709
+ result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_evaluateExpression_",[chunk]);
710
+ result;
711
+ if(smalltalk.assert(lastEmpty)){
712
+ lastEmpty=false;
713
+ lastEmpty;
714
+ return smalltalk.send(result,"_scanFrom_",[parser]);
715
+ };
716
+ };
717
+ })]);
718
+ return self},
719
+ args: ["aStream"],
720
+ source: "import: aStream\x0a | chunk result parser lastEmpty |\x0a parser := ChunkParser on: aStream.\x0a lastEmpty := false.\x0a [chunk := parser nextChunk.\x0a chunk isNil] whileFalse: [\x0a chunk isEmpty\x0a \x09\x09ifTrue: [lastEmpty := true]\x0a \x09\x09ifFalse: [\x0a \x09\x09result := Compiler new evaluateExpression: chunk.\x0a \x09\x09lastEmpty \x0a \x09\x09\x09ifTrue: [\x0a \x09lastEmpty := false.\x0a \x09result scanFrom: parser]]]",
721
+ messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"],
722
+ referencedClasses: ["ChunkParser", "Compiler"]
723
+ }),
724
+ smalltalk.Importer);
725
+
726
+
727
+
728
+ smalltalk.addClass('PackageLoader', smalltalk.Object, [], 'Importer-Exporter');
729
+ smalltalk.addMethod(
730
+ "_initializePackageNamed_prefix_",
731
+ smalltalk.method({
732
+ selector: "initializePackageNamed:prefix:",
733
+ category: 'not yet classified',
734
+ fn: function (packageName,aString){
735
+ var self=this;
736
+ var $1,$2;
737
+ smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]),"_classes",[]),"_do_",[(function(each){
738
+ smalltalk.init(each);
739
+ ;
740
+ return smalltalk.send(each,"_initialize",[]);
741
+ })]);
742
+ $1=smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]);
743
+ smalltalk.send($1,"_commitPathJs_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js"])]);
744
+ $2=smalltalk.send($1,"_commitPathSt_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/st"])]);
745
+ return self},
746
+ args: ["packageName", "aString"],
747
+ source: "initializePackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName) classes do: [ :each |\x0a \x09<smalltalk.init(each)>.\x0a each initialize. ].\x0a \x0a (Package named: packageName) \x0a \x09commitPathJs: '/', aString, '/js';\x0a commitPathSt: '/', aString, '/st'",
748
+ messageSends: ["do:", "initialize", "classes", "named:", "commitPathJs:", ",", "commitPathSt:"],
749
+ referencedClasses: ["Package"]
750
+ }),
751
+ smalltalk.PackageLoader);
752
+
753
+ smalltalk.addMethod(
754
+ "_loadPackage_prefix_",
755
+ smalltalk.method({
756
+ selector: "loadPackage:prefix:",
757
+ category: 'not yet classified',
758
+ fn: function (packageName,aString){
759
+ var self=this;
760
+ var $1;
761
+ var url;
762
+ url=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js/"]),"__comma",[packageName]),"__comma",[".js"]);
763
+ smalltalk.send(jQuery,"_ajax_options_",[url,smalltalk.HashedCollection._fromPairs_([smalltalk.send("type","__minus_gt",["GET"]),smalltalk.send("dataType","__minus_gt",["script"]),smalltalk.send("complete","__minus_gt",[(function(jqXHR,textStatus){
764
+ $1=smalltalk.send(smalltalk.send(jqXHR,"_readyState",[]),"__eq",[(4)]);
765
+ if(smalltalk.assert($1)){
766
+ return smalltalk.send(self,"_initializePackageNamed_prefix_",[packageName,aString]);
767
+ };
768
+ })]),smalltalk.send("error","__minus_gt",[(function(){
769
+ return smalltalk.send(window,"_alert_",[smalltalk.send("Could not load package at: ","__comma",[url])]);
770
+ })])])]);
771
+ return self},
772
+ args: ["packageName", "aString"],
773
+ source: "loadPackage: packageName prefix: aString\x09\x0a\x09| url |\x0a url := '/', aString, '/js/', packageName, '.js'.\x0a\x09jQuery \x0a\x09\x09ajax: url\x0a options: #{\x0a\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09'dataType' -> 'script'.\x0a \x09\x09'complete' -> [ :jqXHR :textStatus | \x0a\x09\x09\x09\x09jqXHR readyState = 4 \x0a \x09ifTrue: [ self initializePackageNamed: packageName prefix: aString ] ].\x0a\x09\x09\x09'error' -> [ window alert: 'Could not load package at: ', url ]\x0a\x09\x09}",
774
+ messageSends: [",", "ajax:options:", "->", "ifTrue:", "initializePackageNamed:prefix:", "=", "readyState", "alert:"],
775
+ referencedClasses: []
776
+ }),
777
+ smalltalk.PackageLoader);
778
+
779
+ smalltalk.addMethod(
780
+ "_loadPackages_prefix_",
781
+ smalltalk.method({
782
+ selector: "loadPackages:prefix:",
783
+ category: 'not yet classified',
784
+ fn: function (aCollection,aString){
785
+ var self=this;
786
+ smalltalk.send(aCollection,"_do_",[(function(each){
787
+ return smalltalk.send(self,"_loadPackage_prefix_",[each,aString]);
788
+ })]);
789
+ return self},
790
+ args: ["aCollection", "aString"],
791
+ source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a \x09self loadPackage: each prefix: aString ]",
792
+ messageSends: ["do:", "loadPackage:prefix:"],
793
+ referencedClasses: []
794
+ }),
795
+ smalltalk.PackageLoader);
796
+
797
+
798
+ smalltalk.addMethod(
799
+ "_loadPackages_prefix_",
800
+ smalltalk.method({
801
+ selector: "loadPackages:prefix:",
802
+ category: 'not yet classified',
803
+ fn: function (aCollection,aString){
804
+ var self=this;
805
+ var $1;
806
+ $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_loadPackages_prefix_",[aCollection,aString]);
807
+ return $1;
808
+ },
809
+ args: ["aCollection", "aString"],
810
+ source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString",
811
+ messageSends: ["loadPackages:prefix:", "new"],
812
+ referencedClasses: []
813
+ }),
814
+ smalltalk.PackageLoader.klass);
815
+
816
+