Browse Source

Outputting instantiateFn.

Herby Vojčík 4 months ago
parent
commit
2729f617f4

+ 40 - 1
lang/src/Kernel-Methods.js

@@ -755,7 +755,7 @@ $globals.BlockClosure);
 
 
 
-$core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
+$core.addClass("CompiledMethod", $globals.Object, ["args", "instantiateFn", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a    Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
 //>>excludeEnd("ide");
@@ -1061,6 +1061,45 @@ messageSends: []
 }),
 $globals.CompiledMethod);
 
+$core.addMethod(
+$core.method({
+selector: "instantiateFn",
+protocol: "accessing",
+fn: function (){
+var self=this,$self=this;
+return $self.instantiateFn;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "instantiateFn\x0a\x09^ instantiateFn",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}),
+$globals.CompiledMethod);
+
+$core.addMethod(
+$core.method({
+selector: "instantiateFn:",
+protocol: "accessing",
+fn: function (anObject){
+var self=this,$self=this;
+$self.instantiateFn=anObject;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anObject"],
+source: "instantiateFn: anObject\x0a\x09instantiateFn := anObject",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}),
+$globals.CompiledMethod);
+
 $core.addMethod(
 $core.method({
 selector: "isCompiledMethod",

+ 9 - 1
lang/src/Kernel-Methods.st

@@ -201,7 +201,7 @@ valueWithTimeout: aNumber
 ! !
 
 Object subclass: #CompiledMethod
-	slots: {#args. #fn. #messageSends. #pragmas. #owner. #methodClass. #protocol. #referencedClasses. #selector. #source}
+	slots: {#args. #instantiateFn. #fn. #messageSends. #pragmas. #owner. #methodClass. #protocol. #referencedClasses. #selector. #source}
 	package: 'Kernel-Methods'!
 !CompiledMethod commentStamp!
 I represent a class method of the system. I hold the source and compiled code of a class method.
@@ -245,6 +245,14 @@ fn: aBlock
 	fn := aBlock
 !
 
+instantiateFn
+	^ instantiateFn
+!
+
+instantiateFn: anObject
+	instantiateFn := anObject
+!
+
 messageSends
 	^ messageSends
 !

File diff suppressed because it is too large
+ 48 - 20
lang/src/Platform-ImportExport.js


+ 7 - 3
lang/src/Platform-ImportExport.st

@@ -334,8 +334,9 @@ exportMethod: aMethod on: aStream
 		write: '$core.addMethod('; lf;
 		write: '$core.method({'; lf;
 		write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;
-		write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;
-		write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;
+		write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf.
+	aMethod fn ifNotNil: [ :fn | aStream write: { 'fn: '. fn compiledSource. ',' }; lf ].
+	aStream
 		write: '//>>excludeStart("ide", pragmas.excludeIdeData);'; lf;
 		write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;
 		write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;
@@ -343,7 +344,10 @@ exportMethod: aMethod on: aStream
 		write: '//>>excludeEnd("ide");'; lf;
 		write: { 'pragmas: '. aMethod basicPragmas asJavaScriptSource. ',' }; lf;
 		write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;
-		write: '}),'; lf;
+		write: '}'.
+	aMethod fn ifNil: [ aStream write: { ', '. aMethod instantiateFn compiledSource } ].
+	aStream
+		write: '),'; lf;
 		write: { aMethod origin asJavaScriptSource. ');' }; lf; lf
 !