Pārlūkot izejas kodu

Meta-manipulation separated from compilation.

There were `Compiler >> setupClass:`
and `ClassBuilder >> setupClass:`. They did the same.
Now, `ClassBuilder` one is used exclusively.

In `install:forClass:category:`, the "set up a compiled method"
was extracted into `ClassBuilder` and was reused from other places.

Now, if you have `CompiledMethod`, you can install it without
dependency on `Compiler`.
Herbert Vojčík 11 gadi atpakaļ
vecāks
revīzija
a7692d381f
9 mainītis faili ar 95 papildinājumiem un 102 dzēšanām
  1. 2 19
      js/Compiler-Core.deploy.js
  2. 7 29
      js/Compiler-Core.js
  3. 13 16
      js/IDE.deploy.js
  4. 16 19
      js/IDE.js
  5. 17 1
      js/Kernel-Classes.deploy.js
  6. 24 3
      js/Kernel-Classes.js
  7. 5 11
      st/Compiler-Core.st
  8. 1 3
      st/IDE.st
  9. 10 1
      st/Kernel-Classes.st

+ 2 - 19
js/Compiler-Core.deploy.js

@@ -150,15 +150,10 @@ smalltalk.method({
 selector: "install:forClass:category:",
 fn: function (aString,aBehavior,anotherString){
 var self=this;
-var compiled;
 return smalltalk.withContext(function($ctx1) { 
var $1;
-compiled=_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior));
-_st(compiled)._category_(anotherString);
-_st(aBehavior)._addCompiledMethod_(compiled);
-_st(self)._setupClass_(aBehavior);
-$1=compiled;
+$1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installCompiled_forClass_category_(_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiled:compiled}, smalltalk.Compiler)})}
+}, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString}, smalltalk.Compiler)})}
 }),
 smalltalk.Compiler);
 
@@ -199,7 +194,6 @@ _st(_st(aClass)._methodDictionary())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
_st(console)._log_(_st(_st(_st(aClass)._name()).__comma(" >> ")).__comma(_st(each)._selector()));
 return _st(self)._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
-_st(self)._setupClass_(aClass);
 $1=_st(aClass)._isMetaclass();
 if(! smalltalk.assert($1)){
 _st(self)._recompile_(_st(aClass)._class());
@@ -228,17 +222,6 @@ return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{}, smalltalk.Comp
 }),
 smalltalk.Compiler);
 
-smalltalk.addMethod(
-"_setupClass_",
-smalltalk.method({
-selector: "setupClass:",
-fn: function (aClass){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
smalltalk.init(aClass);
-return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass}, smalltalk.Compiler)})}
-}),
-smalltalk.Compiler);
-
 smalltalk.addMethod(
 "_source",
 smalltalk.method({

+ 7 - 29
js/Compiler-Core.js

@@ -202,19 +202,14 @@ selector: "install:forClass:category:",
 category: 'compiling',
 fn: function (aString,aBehavior,anotherString){
 var self=this;
-var compiled;
 return smalltalk.withContext(function($ctx1) { 
var $1;
-compiled=_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior));
-_st(compiled)._category_(anotherString);
-_st(aBehavior)._addCompiledMethod_(compiled);
-_st(self)._setupClass_(aBehavior);
-$1=compiled;
+$1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installCompiled_forClass_category_(_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiled:compiled}, smalltalk.Compiler)})},
+}, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString}, smalltalk.Compiler)})},
 args: ["aString", "aBehavior", "anotherString"],
-source: "install: aString forClass: aBehavior category: anotherString\x0a\x09| compiled |\x0a\x09compiled := self eval: (self compile: aString forClass: aBehavior).\x0a\x09compiled category: anotherString.\x0a\x09aBehavior addCompiledMethod: compiled.\x0a    self setupClass: aBehavior.\x0a\x09^compiled",
-messageSends: ["eval:", "compile:forClass:", "category:", "addCompiledMethod:", "setupClass:"],
-referencedClasses: []
+source: "install: aString forClass: aBehavior category: anotherString\x0a   \x09^ ClassBuilder new\x0a    \x09installCompiled: (self eval: (self compile: aString forClass: aBehavior))\x0a        forClass: aBehavior\x0a        category: anotherString",
+messageSends: ["installCompiled:forClass:category:", "eval:", "compile:forClass:", "new"],
+referencedClasses: ["ClassBuilder"]
 }),
 smalltalk.Compiler);
 
@@ -266,15 +261,14 @@ _st(_st(aClass)._methodDictionary())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
_st(console)._log_(_st(_st(_st(aClass)._name()).__comma(" >> ")).__comma(_st(each)._selector()));
 return _st(self)._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
-_st(self)._setupClass_(aClass);
 $1=_st(aClass)._isMetaclass();
 if(! smalltalk.assert($1)){
 _st(self)._recompile_(_st(aClass)._class());
 };
 return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass}, smalltalk.Compiler)})},
 args: ["aClass"],
-source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09console log: aClass name, ' >> ', each selector.\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09self setupClass: aClass.\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
-messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "setupClass:", "ifFalse:", "recompile:", "class", "isMetaclass"],
+source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09console log: aClass name, ' >> ', each selector.\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09\x22self setupClass: aClass.\x22\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
+messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "ifFalse:", "recompile:", "class", "isMetaclass"],
 referencedClasses: []
 }),
 smalltalk.Compiler);
@@ -304,22 +298,6 @@ referencedClasses: ["Transcript", "Smalltalk"]
 }),
 smalltalk.Compiler);
 
-smalltalk.addMethod(
-"_setupClass_",
-smalltalk.method({
-selector: "setupClass:",
-category: 'compiling',
-fn: function (aClass){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
smalltalk.init(aClass);
-return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass}, smalltalk.Compiler)})},
-args: ["aClass"],
-source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass)>",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Compiler);
-
 smalltalk.addMethod(
 "_source",
 smalltalk.method({

+ 13 - 16
js/IDE.deploy.js

@@ -1619,7 +1619,7 @@ selector: "compileMethodDefinitionFor:",
 fn: function (aClass){
 var self=this;
 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={};
 try {
 source=_st(self["@sourceArea"])._val();
@@ -1640,23 +1640,20 @@ return $3;
 };
 _st(compiler)._currentClass_(aClass);
 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);
-$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)._selectMethod_(method);
 return self}

+ 16 - 19
js/IDE.js

@@ -2105,7 +2105,7 @@ category: 'actions',
 fn: function (aClass){
 var self=this;
 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={};
 try {
 source=_st(self["@sourceArea"])._val();
@@ -2126,32 +2126,29 @@ return $3;
 };
 _st(compiler)._currentClass_(aClass);
 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);
-$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)._selectMethod_(method);
 return self}
 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)})},
 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);
 

+ 17 - 1
js/Kernel-Classes.deploy.js

@@ -989,6 +989,22 @@ return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,an
 }),
 smalltalk.ClassBuilder);
 
+smalltalk.addMethod(
+"_installCompiled_forClass_category_",
+smalltalk.method({
+selector: "installCompiled:forClass:category:",
+fn: function (aCompiledMethod,aBehavior,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+_st(aCompiledMethod)._category_(aString);
+_st(aBehavior)._addCompiledMethod_(aCompiledMethod);
+_st(self)._setupClass_(aBehavior);
+$1=aCompiledMethod;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"installCompiled:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString}, smalltalk.ClassBuilder)})}
+}),
+smalltalk.ClassBuilder);
+
 smalltalk.addMethod(
 "_instanceVariableNamesFor_",
 smalltalk.method({
@@ -1166,7 +1182,7 @@ return _st(chunk)._isEmpty();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
 return smalltalk.withContext(function($ctx2) {
return _st(self)._compileMethod_(chunk);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(_st((smalltalk.Compiler || Compiler))._new())._setupClass_(self["@class"]);
+_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._setupClass_(self["@class"]);
 return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCategoryReader)})}
 }),
 smalltalk.ClassCategoryReader);

+ 24 - 3
js/Kernel-Classes.js

@@ -1328,6 +1328,27 @@ referencedClasses: ["Compiler"]
 }),
 smalltalk.ClassBuilder);
 
+smalltalk.addMethod(
+"_installCompiled_forClass_category_",
+smalltalk.method({
+selector: "installCompiled:forClass:category:",
+category: 'meta api',
+fn: function (aCompiledMethod,aBehavior,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+_st(aCompiledMethod)._category_(aString);
+_st(aBehavior)._addCompiledMethod_(aCompiledMethod);
+_st(self)._setupClass_(aBehavior);
+$1=aCompiledMethod;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"installCompiled:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString}, smalltalk.ClassBuilder)})},
+args: ["aCompiledMethod", "aBehavior", "aString"],
+source: "installCompiled: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a    self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
+messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
 smalltalk.addMethod(
 "_instanceVariableNamesFor_",
 smalltalk.method({
@@ -1557,12 +1578,12 @@ return _st(chunk)._isEmpty();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
 return smalltalk.withContext(function($ctx2) {
return _st(self)._compileMethod_(chunk);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(_st((smalltalk.Compiler || Compiler))._new())._setupClass_(self["@class"]);
+_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._setupClass_(self["@class"]);
 return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCategoryReader)})},
 args: ["aChunkParser"],
-source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09    self compileMethod: chunk].\x0a\x09Compiler new setupClass: class",
+source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09    self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
 messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
-referencedClasses: ["Compiler"]
+referencedClasses: ["ClassBuilder"]
 }),
 smalltalk.ClassCategoryReader);
 

+ 5 - 11
st/Compiler-Core.st

@@ -85,12 +85,10 @@ evaluateExpression: aString
 !
 
 install: aString forClass: aBehavior category: anotherString
-	| compiled |
-	compiled := self eval: (self compile: aString forClass: aBehavior).
-	compiled category: anotherString.
-	aBehavior addCompiledMethod: compiled.
-    self setupClass: aBehavior.
-	^compiled
+   	^ ClassBuilder new
+    	installCompiled: (self eval: (self compile: aString forClass: aBehavior))
+        forClass: aBehavior
+        category: anotherString
 !
 
 parse: aString
@@ -105,7 +103,7 @@ recompile: aClass
 	aClass methodDictionary do: [:each |
 		console log: aClass name, ' >> ', each selector.
 		self install: each source forClass: aClass category: each category].
-	self setupClass: aClass.
+	"self setupClass: aClass."
 	aClass isMetaclass ifFalse: [self recompile: aClass class]
 !
 
@@ -113,10 +111,6 @@ recompileAll
 	Smalltalk current classes do: [:each |
 		Transcript show: each; cr.
 		[self recompile: each] valueWithTimeout: 100]
-!
-
-setupClass: aClass
-	<smalltalk.init(aClass)>
 ! !
 
 !Compiler class methodsFor: 'compiling'!

+ 1 - 3
st/IDE.st

@@ -838,15 +838,13 @@ compileMethodDefinitionFor: aClass
 	^window alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
     compiler currentClass: aClass.
     method := compiler eval: (compiler compileNode: node).
-    method category: selectedProtocol.
     compiler unknownVariables do: [:each |
          "Do not try to redeclare javascript's objects"
          (window at: each) ifNil: [
 	 	(window confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
 			self addInstanceVariableNamed: each toClass: aClass.
 			^self compileMethodDefinitionFor: aClass]]].
-    aClass addCompiledMethod: method.
-    compiler setupClass: aClass.
+    ClassBuilder new installCompiled: method forClass: aClass category: selectedProtocol.
     self updateMethodsList.
     self selectMethod: method
 !

+ 10 - 1
st/Kernel-Classes.st

@@ -439,6 +439,15 @@ superclass: aClass subclass: aString instanceVariableNames: aString2 package: aS
 	^newClass
 ! !
 
+!ClassBuilder methodsFor: 'meta api'!
+
+installCompiled: aCompiledMethod forClass: aBehavior category: aString
+	aCompiledMethod category: aString.
+	aBehavior addCompiledMethod: aCompiledMethod.
+    self setupClass: aBehavior.
+	^aCompiledMethod
+! !
+
 !ClassBuilder methodsFor: 'private'!
 
 addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
@@ -576,7 +585,7 @@ scanFrom: aChunkParser
 	[chunk := aChunkParser nextChunk.
 	chunk isEmpty] whileFalse: [
 	    self compileMethod: chunk].
-	Compiler new setupClass: class
+	ClassBuilder new setupClass: class
 ! !
 
 !ClassCategoryReader methodsFor: 'initialization'!