|
@@ -2105,7 +2105,7 @@ category: 'actions',
|
|
fn: function (aClass){
|
|
fn: function (aClass){
|
|
var self=this;
|
|
var self=this;
|
|
var compiler,method,source,node;
|
|
var compiler,method,source,node;
|
|
-return smalltalk.withContext(function($ctx1) {
var $1,$2,$3,$4,$6,$8,$9,$7,$5;
|
|
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
var $1,$2,$3,$4,$5,$6;
|
|
var $early={};
|
|
var $early={};
|
|
try {
|
|
try {
|
|
source=_st(self["@sourceArea"])._val();
|
|
source=_st(self["@sourceArea"])._val();
|
|
@@ -2126,32 +2126,29 @@ return $3;
|
|
};
|
|
};
|
|
_st(compiler)._currentClass_(aClass);
|
|
_st(compiler)._currentClass_(aClass);
|
|
method=_st(compiler)._eval_(_st(compiler)._compileNode_(node));
|
|
method=_st(compiler)._eval_(_st(compiler)._compileNode_(node));
|
|
-_st(method)._category_(self["@selectedProtocol"]);
|
|
|
|
-$4=_st(compiler)._unknownVariables();
|
|
|
|
-$5=(function(each){
|
|
|
|
-return smalltalk.withContext(function($ctx2) {
$6=_st(window)._at_(each);
|
|
|
|
-$7=(function(){
|
|
|
|
-return smalltalk.withContext(function($ctx3) {
$8=_st(window)._confirm_(_st(_st("Declare '").__comma(each)).__comma("' as instance variable?"));
|
|
|
|
-if(smalltalk.assert($8)){
|
|
|
|
|
|
+_st(_st(compiler)._unknownVariables())._do_((function(each){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
$4=_st(window)._at_(each);
|
|
|
|
+if(($receiver = $4) == nil || $receiver == undefined){
|
|
|
|
+$5=_st(window)._confirm_(_st(_st("Declare '").__comma(each)).__comma("' as instance variable?"));
|
|
|
|
+if(smalltalk.assert($5)){
|
|
_st(self)._addInstanceVariableNamed_toClass_(each,aClass);
|
|
_st(self)._addInstanceVariableNamed_toClass_(each,aClass);
|
|
-$9=_st(self)._compileMethodDefinitionFor_(aClass);
|
|
|
|
-throw $early=[$9];
|
|
|
|
|
|
+$6=_st(self)._compileMethodDefinitionFor_(aClass);
|
|
|
|
+throw $early=[$6];
|
|
};
|
|
};
|
|
-}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
|
|
|
|
-return _st($6)._ifNil_($7);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
|
|
|
|
-_st($4)._do_($5);
|
|
|
|
-_st(aClass)._addCompiledMethod_(method);
|
|
|
|
-_st(compiler)._setupClass_(aClass);
|
|
|
|
|
|
+} else {
|
|
|
|
+return $4;
|
|
|
|
+};
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
|
|
|
+_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installCompiled_forClass_category_(method,aClass,self["@selectedProtocol"]);
|
|
_st(self)._updateMethodsList();
|
|
_st(self)._updateMethodsList();
|
|
_st(self)._selectMethod_(method);
|
|
_st(self)._selectMethod_(method);
|
|
return self}
|
|
return self}
|
|
catch(e) {if(e===$early)return e[0]; throw e}
|
|
catch(e) {if(e===$early)return e[0]; throw e}
|
|
}, function($ctx1) {$ctx1.fill(self,"compileMethodDefinitionFor:",{aClass:aClass,compiler:compiler,method:method,source:source,node:node}, smalltalk.Browser)})},
|
|
}, function($ctx1) {$ctx1.fill(self,"compileMethodDefinitionFor:",{aClass:aClass,compiler:compiler,method:method,source:source,node:node}, smalltalk.Browser)})},
|
|
args: ["aClass"],
|
|
args: ["aClass"],
|
|
-source: "compileMethodDefinitionFor: aClass\x0a | compiler method source node | \x0a source := sourceArea val.\x0a selectedProtocol ifNil: [selectedProtocol := selectedMethod category].\x0a compiler := Compiler new.\x0a compiler source: source.\x0a node := compiler parse: source.\x0a node isParseFailure ifTrue: [\x0a\x09^window alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].\x0a compiler currentClass: aClass.\x0a method := compiler eval: (compiler compileNode: node).\x0a method category: selectedProtocol.\x0a compiler unknownVariables do: [:each |\x0a \x22Do not try to redeclare javascript's objects\x22\x0a (window at: each) ifNil: [\x0a\x09 \x09(window confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [\x0a\x09\x09\x09self addInstanceVariableNamed: each toClass: aClass.\x0a\x09\x09\x09^self compileMethodDefinitionFor: aClass]]].\x0a aClass addCompiledMethod: method.\x0a compiler setupClass: aClass.\x0a self updateMethodsList.\x0a self selectMethod: method",
|
|
|
|
-messageSends: ["val", "ifNil:", "category", "new", "source:", "parse:", "ifTrue:", "alert:", ",", "asString", "position", "reason", "isParseFailure", "currentClass:", "eval:", "compileNode:", "category:", "do:", "addInstanceVariableNamed:toClass:", "compileMethodDefinitionFor:", "confirm:", "at:", "unknownVariables", "addCompiledMethod:", "setupClass:", "updateMethodsList", "selectMethod:"],
|
|
|
|
-referencedClasses: ["Compiler"]
|
|
|
|
|
|
+source: "compileMethodDefinitionFor: aClass\x0a | compiler method source node | \x0a source := sourceArea val.\x0a selectedProtocol ifNil: [selectedProtocol := selectedMethod category].\x0a compiler := Compiler new.\x0a compiler source: source.\x0a node := compiler parse: source.\x0a node isParseFailure ifTrue: [\x0a\x09^window alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].\x0a compiler currentClass: aClass.\x0a method := compiler eval: (compiler compileNode: node).\x0a compiler unknownVariables do: [:each |\x0a \x22Do not try to redeclare javascript's objects\x22\x0a (window at: each) ifNil: [\x0a\x09 \x09(window confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [\x0a\x09\x09\x09self addInstanceVariableNamed: each toClass: aClass.\x0a\x09\x09\x09^self compileMethodDefinitionFor: aClass]]].\x0a ClassBuilder new installCompiled: method forClass: aClass category: selectedProtocol.\x0a self updateMethodsList.\x0a self selectMethod: method",
|
|
|
|
+messageSends: ["val", "ifNil:", "category", "new", "source:", "parse:", "ifTrue:", "alert:", ",", "asString", "position", "reason", "isParseFailure", "currentClass:", "eval:", "compileNode:", "do:", "addInstanceVariableNamed:toClass:", "compileMethodDefinitionFor:", "confirm:", "at:", "unknownVariables", "installCompiled:forClass:category:", "updateMethodsList", "selectMethod:"],
|
|
|
|
+referencedClasses: ["Compiler", "ClassBuilder"]
|
|
}),
|
|
}),
|
|
smalltalk.Browser);
|
|
smalltalk.Browser);
|
|
|
|
|