Quellcode durchsuchen

commit-related things are all in through *Importer-Exporter

Herbert Vojčík vor 11 Jahren
Ursprung
Commit
3fc6924fae

+ 99 - 0
js/Importer-Exporter.deploy.js

@@ -1017,4 +1017,103 @@ return $1;
 messageSends: ["commit:", "for:", "transportType"]}),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJs",
+fn: function (){
+var self=this;
+function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($PackageHandler())._for_(self._transportType()))._commitPathJsFor_(self);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
+messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "for:", "transportType", "ifNil:"]}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJs:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_put_("commitPathJs",aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
+messageSends: ["at:put:", "ifNil:"]}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathSt",
+fn: function (){
+var self=this;
+function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($PackageHandler())._for_(self._transportType()))._commitPathStFor_(self);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
+messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "for:", "transportType", "ifNil:"]}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathSt:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_put_("commitPathSt",aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
+messageSends: ["at:put:", "ifNil:"]}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transportType",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (self.transport && self.transport.type) || 'unknown';;
+return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
+messageSends: []}),
+smalltalk.Package);
+
 })(global_smalltalk,global_nil,global__st);

+ 124 - 0
js/Importer-Exporter.js

@@ -1264,4 +1264,128 @@ referencedClasses: ["PackageHandler"]
 }),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJs",
+category: '*Importer-Exporter',
+fn: function (){
+var self=this;
+function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($PackageHandler())._for_(self._transportType()))._commitPathJsFor_(self);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
+args: [],
+source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [(PackageHandler for: self transportType) commitPathJsFor: self]",
+messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "for:", "transportType", "ifNil:"],
+referencedClasses: ["PackageHandler"]
+}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJs:",
+category: '*Importer-Exporter',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_put_("commitPathJs",aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
+args: ["aString"],
+source: "commitPathJs: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString",
+messageSends: ["at:put:", "ifNil:"],
+referencedClasses: []
+}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathSt",
+category: '*Importer-Exporter',
+fn: function (){
+var self=this;
+function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($PackageHandler())._for_(self._transportType()))._commitPathStFor_(self);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
+args: [],
+source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [(PackageHandler for: self transportType) commitPathStFor: self]",
+messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "for:", "transportType", "ifNil:"],
+referencedClasses: ["PackageHandler"]
+}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathSt:",
+category: '*Importer-Exporter',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self["@extension"];
+if(($receiver = $3) == nil || $receiver == undefined){
+self["@extension"]=smalltalk.HashedCollection._from_([]);
+$2=self["@extension"];
+} else {
+$2=$3;
+};
+$1=_st($2)._at_put_("commitPathSt",aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
+args: ["aString"],
+source: "commitPathSt: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString",
+messageSends: ["at:put:", "ifNil:"],
+referencedClasses: []
+}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transportType",
+category: '*Importer-Exporter',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (self.transport && self.transport.type) || 'unknown';;
+return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
+args: [],
+source: "transportType\x0a\x09<return (self.transport && self.transport.type) || 'unknown';>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Package);
+
 })(global_smalltalk,global_nil,global__st);

+ 1 - 72
js/Kernel-Objects.deploy.js

@@ -3058,7 +3058,7 @@ smalltalk.ClassOrganizer);
 smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
 
 
-smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
+smalltalk.addClass('Package', smalltalk.Object, ['extension'], 'Kernel-Objects');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classes",
@@ -3072,66 +3072,6 @@ return $1;
 messageSends: ["elements", "organization"]}),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathJs",
-fn: function (){
-var self=this;
-function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self["@commitPathJs"];
-if(($receiver = $2) == nil || $receiver == undefined){
-$1=_st(_st($PackageHandler())._for_(self._transportType()))._commitPathJsFor_(self);
-} else {
-$1=$2;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
-messageSends: ["ifNil:", "commitPathJsFor:", "for:", "transportType"]}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathJs:",
-fn: function (aString){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-self["@commitPathJs"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
-messageSends: []}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathSt",
-fn: function (){
-var self=this;
-function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self["@commitPathSt"];
-if(($receiver = $2) == nil || $receiver == undefined){
-$1=_st(_st($PackageHandler())._for_(self._transportType()))._commitPathStFor_(self);
-} else {
-$1=$2;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
-messageSends: ["ifNil:", "commitPathStFor:", "for:", "transportType"]}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathSt:",
-fn: function (aString){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-self["@commitPathSt"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
-messageSends: []}),
-smalltalk.Package);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "isPackage",
@@ -3228,17 +3168,6 @@ return $1;
 messageSends: ["sortedClasses:", "classes", "class"]}),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "transportType",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return (self.transport && self.transport.type) || 'unknown';;
-return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
-messageSends: []}),
-smalltalk.Package);
-
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
 smalltalk.addMethod(

+ 1 - 97
js/Kernel-Objects.js

@@ -4188,7 +4188,7 @@ smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects'
 smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
 
 
-smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
+smalltalk.addClass('Package', smalltalk.Object, ['extension'], 'Kernel-Objects');
 smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a    Smalltalk current packageAt: 'Kernel'\x0a    Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
 smalltalk.addMethod(
 smalltalk.method({
@@ -4208,86 +4208,6 @@ referencedClasses: []
 }),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathJs",
-category: 'accessing',
-fn: function (){
-var self=this;
-function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self["@commitPathJs"];
-if(($receiver = $2) == nil || $receiver == undefined){
-$1=_st(_st($PackageHandler())._for_(self._transportType()))._commitPathJsFor_(self);
-} else {
-$1=$2;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
-args: [],
-source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [(PackageHandler for: self transportType) commitPathJsFor: self]",
-messageSends: ["ifNil:", "commitPathJsFor:", "for:", "transportType"],
-referencedClasses: ["PackageHandler"]
-}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathJs:",
-category: 'accessing',
-fn: function (aString){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-self["@commitPathJs"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
-args: ["aString"],
-source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathSt",
-category: 'accessing',
-fn: function (){
-var self=this;
-function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self["@commitPathSt"];
-if(($receiver = $2) == nil || $receiver == undefined){
-$1=_st(_st($PackageHandler())._for_(self._transportType()))._commitPathStFor_(self);
-} else {
-$1=$2;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
-args: [],
-source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [(PackageHandler for: self transportType) commitPathStFor: self]",
-messageSends: ["ifNil:", "commitPathStFor:", "for:", "transportType"],
-referencedClasses: ["PackageHandler"]
-}),
-smalltalk.Package);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "commitPathSt:",
-category: 'accessing',
-fn: function (aString){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-self["@commitPathSt"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
-args: ["aString"],
-source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Package);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "isPackage",
@@ -4419,22 +4339,6 @@ referencedClasses: []
 }),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "transportType",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return (self.transport && self.transport.type) || 'unknown';;
-return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
-args: [],
-source: "transportType\x0a\x09<return (self.transport && self.transport.type) || 'unknown';>",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Package);
-
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
 smalltalk.addMethod(

+ 20 - 0
st/Importer-Exporter.st

@@ -550,5 +550,25 @@ loadPackages: aCollection prefix: aString
 
 commit
 	^ (PackageHandler for: self transportType) commit: self
+!
+
+commitPathJs
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [(PackageHandler for: self transportType) commitPathJsFor: self]
+!
+
+commitPathJs: aString
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString
+!
+
+commitPathSt
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [(PackageHandler for: self transportType) commitPathStFor: self]
+!
+
+commitPathSt: aString
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString
+!
+
+transportType
+	<return (self.transport && self.transport.type) || 'unknown';>
 ! !
 

+ 1 - 21
st/Kernel-Objects.st

@@ -1411,7 +1411,7 @@ Organizer subclass: #PackageOrganizer
 I am an organizer specific to packages. I hold classes categorization information.!
 
 Object subclass: #Package
-	instanceVariableNames: 'commitPathJs commitPathSt'
+	instanceVariableNames: 'extension'
 	package: 'Kernel-Objects'!
 !Package commentStamp!
 I am similar to a "class category" typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.
@@ -1433,22 +1433,6 @@ You can fetch a package from the server:
 
 !Package methodsFor: 'accessing'!
 
-commitPathJs
-	^ commitPathJs ifNil: [(PackageHandler for: self transportType) commitPathJsFor: self]
-!
-
-commitPathJs: aString
-	commitPathJs := aString
-!
-
-commitPathSt
-	^ commitPathSt ifNil: [(PackageHandler for: self transportType) commitPathStFor: self]
-!
-
-commitPathSt: aString
-	commitPathSt := aString
-!
-
 name
 	<return self.pkgName>
 !
@@ -1459,10 +1443,6 @@ name: aString
 
 organization
 	^ self basicAt: 'organization'
-!
-
-transportType
-	<return (self.transport && self.transport.type) || 'unknown';>
 ! !
 
 !Package methodsFor: 'classes'!