Browse Source

packages created in IDE get default transport type

Herbert Vojčík 10 years ago
parent
commit
7c99585512

+ 2 - 2
js/Kernel-Classes.deploy.js

@@ -1243,11 +1243,11 @@ return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=_st($Package())._named_ifAbsent_(aString,(function(){
 return smalltalk.withContext(function($ctx2) {
-return _st(_st($Smalltalk())._current())._createPackage_(aString);
+return _st(_st($Smalltalk())._current())._createDefaultPackage_(aString);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
-messageSends: ["named:ifAbsent:", "createPackage:", "current"]}),
+messageSends: ["named:ifAbsent:", "createDefaultPackage:", "current"]}),
 smalltalk.ClassBuilder);
 
 smalltalk.addMethod(

+ 3 - 3
js/Kernel-Classes.js

@@ -1628,13 +1628,13 @@ return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=_st($Package())._named_ifAbsent_(aString,(function(){
 return smalltalk.withContext(function($ctx2) {
-return _st(_st($Smalltalk())._current())._createPackage_(aString);
+return _st(_st($Smalltalk())._current())._createDefaultPackage_(aString);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
 args: ["aString"],
-source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
-messageSends: ["named:ifAbsent:", "createPackage:", "current"],
+source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createDefaultPackage: aString ]",
+messageSends: ["named:ifAbsent:", "createDefaultPackage:", "current"],
 referencedClasses: ["Smalltalk", "Package"]
 }),
 smalltalk.ClassBuilder);

+ 24 - 0
js/Kernel-Infrastructure.deploy.js

@@ -1066,6 +1066,17 @@ return $1;
 messageSends: ["sortedClasses:", "classes", "class"]}),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withDefaultTransport",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.withDefaultTransport();
+return self}, function($ctx1) {$ctx1.fill(self,"withDefaultTransport",{},smalltalk.Package)})},
+messageSends: []}),
+smalltalk.Package);
+
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
 smalltalk.addMethod(
@@ -1433,6 +1444,19 @@ return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)
 messageSends: []}),
 smalltalk.Smalltalk);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "createDefaultPackage:",
+fn: function (packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._createPackage_(packageName))._withDefaultTransport();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"createDefaultPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
+messageSends: ["withDefaultTransport", "createPackage:"]}),
+smalltalk.Smalltalk);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "createPackage:",

+ 36 - 2
js/Kernel-Infrastructure.js

@@ -1419,6 +1419,22 @@ referencedClasses: []
 }),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withDefaultTransport",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.withDefaultTransport();
+return self}, function($ctx1) {$ctx1.fill(self,"withDefaultTransport",{},smalltalk.Package)})},
+args: [],
+source: "withDefaultTransport\x0a\x09<return self.withDefaultTransport()>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Package);
+
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
 smalltalk.addMethod(
@@ -1901,15 +1917,33 @@ smalltalk.Smalltalk);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "createPackage:",
+selector: "createDefaultPackage:",
 category: 'packages',
 fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._createPackage_(packageName))._withDefaultTransport();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"createDefaultPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
+args: ["packageName"],
+source: "createDefaultPackage: packageName\x0a\x09\x22Create and bind a new package with given name and default transport type and return it.\x22\x0a\x09^ (self createPackage: packageName) withDefaultTransport",
+messageSends: ["withDefaultTransport", "createPackage:"],
+referencedClasses: []
+}),
+smalltalk.Smalltalk);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "createPackage:",
+category: 'private',
+fn: function (packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
 return smalltalk.addPackage(packageName);
 return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
 args: ["packageName"],
-source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
+source: "createPackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
 messageSends: [],
 referencedClasses: []
 }),

+ 1 - 1
st/Kernel-Classes.st

@@ -685,7 +685,7 @@ basicSwapClassNames: aClass with: anotherClass
 
 createPackageNamed: aString
 	^ Package named: aString ifAbsent: [
-		Smalltalk current createPackage: aString ]
+		Smalltalk current createDefaultPackage: aString ]
 !
 
 rawRenameClass: aClass to: aString

+ 12 - 3
st/Kernel-Infrastructure.st

@@ -484,6 +484,10 @@ name: aString
 
 organization
 	^ self basicAt: 'organization'
+!
+
+withDefaultTransport
+	<return self.withDefaultTransport()>
 ! !
 
 !Package methodsFor: 'classes'!
@@ -831,9 +835,9 @@ globalJsVariables
 
 !Smalltalk methodsFor: 'packages'!
 
-createPackage: packageName
-	"Create and bind a new package with given name and return it."
-	<return smalltalk.addPackage(packageName)>
+createDefaultPackage: packageName
+	"Create and bind a new package with given name and default transport type and return it."
+	^ (self createPackage: packageName) withDefaultTransport
 !
 
 deletePackage: packageName
@@ -888,6 +892,11 @@ basicParse: aString
 	<return smalltalk.parser.parse(aString)>
 !
 
+createPackage: packageName
+	"Create and bind a new bare package with given name and return it."
+	<return smalltalk.addPackage(packageName)>
+!
+
 createPackage: packageName properties: aDict
 	"Needed to import .st files: they begin with this call."
 	self deprecatedAPI.

+ 10 - 0
support/boot.js

@@ -414,6 +414,16 @@ function ClassesBrik(brikz, st) {
 		return st.packages[pkgName];
 	};
 
+	SmalltalkPackage.prototype.withDefaultTransport = function () {
+		if (this.transport) {
+			throw new Error("Cannot set default transport; transport already set");
+		}
+		if (st._defaultTransportType) {
+			this.transport = { type: st._defaultTransportType };
+		}
+		return this;
+	};
+
 	/* Add a class to the smalltalk object, creating a new one if needed.
 	 A Package is lazily created if it does not exist with given name. */