Sfoglia il codice sorgente

Merge branch 'smalltalk-cleaning' of https://github.com/herby/amber into herby-smalltalk-cleaning

Conflicts:
	js/Kernel-Infrastructure.deploy.js
	js/Kernel-Infrastructure.js
	st/Kernel-Infrastructure.st
Nicolas Petton 11 anni fa
parent
commit
ba4467b42f
2 ha cambiato i file con 77 aggiunte e 56 eliminazioni
  1. 42 23
      js/Kernel-Infrastructure.js
  2. 35 33
      st/Kernel-Infrastructure.st

+ 42 - 23
js/Kernel-Infrastructure.js

@@ -1853,12 +1853,12 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self._basicAt_("amdRequire");
+$1=self._at_("amdRequire");
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},smalltalk.Smalltalk)})},
 args: [],
-source: "amdRequire\x0a\x09^ self basicAt: 'amdRequire'",
-messageSends: ["basicAt:"],
+source: "amdRequire\x0a\x09^ self at: 'amdRequire'",
+messageSends: ["at:"],
 referencedClasses: []
 }),
 smalltalk.Smalltalk);
@@ -1898,11 +1898,31 @@ category: 'accessing',
 fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-return self[aString];
-return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
+var $1;
+$1=self._basicAt_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
 args: ["aString"],
-source: "at: aString\x0a\x09<return self[aString]>",
-messageSends: [],
+source: "at: aString\x0a\x09^ self basicAt: aString",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.Smalltalk);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+category: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_put_(aString,anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.Smalltalk)})},
+args: ["aString", "anObject"],
+source: "at: aString put: anObject\x0a\x09^ self basicAt: aString put: anObject",
+messageSends: ["basicAt:put:"],
 referencedClasses: []
 }),
 smalltalk.Smalltalk);
@@ -1942,7 +1962,7 @@ smalltalk.Smalltalk);
 smalltalk.addMethod(
 smalltalk.method({
 selector: "createPackage:",
-category: 'private',
+category: 'packages',
 fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
@@ -1986,12 +2006,12 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self._basicAt_("defaultAMDNamespace");
+$1=self._at_("defaultAMDNamespace");
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},smalltalk.Smalltalk)})},
 args: [],
-source: "defaultAmdNamespace\x0a\x09^ self basicAt: 'defaultAMDNamespace'",
-messageSends: ["basicAt:"],
+source: "defaultAmdNamespace\x0a\x09^ self at: 'defaultAMDNamespace'",
+messageSends: ["at:"],
 referencedClasses: []
 }),
 smalltalk.Smalltalk);
@@ -2003,11 +2023,11 @@ category: 'accessing amd',
 fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self._basicAt_put_("defaultAMDNamespace",aString);
+self._at_put_("defaultAMDNamespace",aString);
 return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},smalltalk.Smalltalk)})},
 args: ["aString"],
-source: "defaultAmdNamespace: aString\x0a\x09self basicAt: 'defaultAMDNamespace' put: aString",
-messageSends: ["basicAt:put:"],
+source: "defaultAmdNamespace: aString\x0a\x09self at: 'defaultAMDNamespace' put: aString",
+messageSends: ["at:put:"],
 referencedClasses: []
 }),
 smalltalk.Smalltalk);
@@ -2015,7 +2035,7 @@ smalltalk.Smalltalk);
 smalltalk.addMethod(
 smalltalk.method({
 selector: "deleteClass:",
-category: 'classes',
+category: 'private',
 fn: function (aClass){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
@@ -2049,14 +2069,14 @@ smalltalk.Smalltalk);
 smalltalk.addMethod(
 smalltalk.method({
 selector: "deletePackage:",
-category: 'packages',
+category: 'private',
 fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-delete smalltalk.packages[packageName];
+delete self.packages[packageName];
 return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
 args: ["packageName"],
-source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
+source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete self.packages[packageName]>",
 messageSends: [],
 referencedClasses: []
 }),
@@ -2197,7 +2217,7 @@ smalltalk.Smalltalk);
 smalltalk.addMethod(
 smalltalk.method({
 selector: "pseudoVariableNames",
-category: 'packages',
+category: 'accessing',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
@@ -2299,13 +2319,13 @@ $1;
 } else {
 self._error_("Already exists a package called: ".__comma(newName));
 };
-_st(self._basicAt_("packages"))._at_put_(newName,pkg);
+_st(self._at_("packages"))._at_put_(newName,pkg);
 _st(pkg)._name_(newName);
 self._deletePackage_(packageName);
 return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
 args: ["packageName", "newName"],
-source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
-messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
+source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
+messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
 referencedClasses: []
 }),
 smalltalk.Smalltalk);
@@ -2343,7 +2363,6 @@ referencedClasses: []
 smalltalk.Smalltalk);
 
 
-smalltalk.Smalltalk.klass.iVarNames = ['current'];
 smalltalk.addMethod(
 smalltalk.method({
 selector: "current",

+ 35 - 33
st/Kernel-Infrastructure.st

@@ -474,6 +474,12 @@ You can fetch a package from the server:
 
 !Package methodsFor: 'accessing'!
 
+basicTransport
+	"Answer the transport literal JavaScript object as setup in the JavaScript file, if any"
+	
+	<return self.transport>
+!
+
 name
 	<return self.pkgName>
 !
@@ -493,12 +499,6 @@ transport
 			yourself ]
 !
 
-basicTransport
-	"Answer the transport literal JavaScript object as setup in the JavaScript file, if any"
-	
-	<return self.transport>
-!
-
 transport: aPackageTransport
 	transport := aPackageTransport
 ! !
@@ -746,7 +746,11 @@ It requires the `Compiler` package and the `js/parser.js` parser file in order t
 !Smalltalk methodsFor: 'accessing'!
 
 at: aString
-	<return self[aString]>
+	^ self basicAt: aString
+!
+
+at: aString put: anObject
+	^ self basicAt: aString put: anObject
 !
 
 parse: aString
@@ -761,6 +765,10 @@ parse: aString
 		yourself
 !
 
+pseudoVariableNames
+	^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')
+!
+
 readJSObject: anObject
 	<return self.readJSObject(anObject)>
 !
@@ -779,15 +787,15 @@ version
 !Smalltalk methodsFor: 'accessing amd'!
 
 amdRequire
-	^ self basicAt: 'amdRequire'
+	^ self at: 'amdRequire'
 !
 
 defaultAmdNamespace
-	^ self basicAt: 'defaultAMDNamespace'
+	^ self at: 'defaultAMDNamespace'
 !
 
 defaultAmdNamespace: aString
-	self basicAt: 'defaultAMDNamespace' put: aString
+	self at: 'defaultAMDNamespace' put: aString
 ! !
 
 !Smalltalk methodsFor: 'classes'!
@@ -796,12 +804,6 @@ classes
 	<return self.classes()>
 !
 
-deleteClass: aClass
-	"Deletes a class by deleting its binding only. Use #removeClass instead"
-	
-	<self.removeClass(aClass)>
-!
-
 removeClass: aClass
 	aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!!'].
 	
@@ -845,11 +847,9 @@ globalJsVariables
 
 !Smalltalk methodsFor: 'packages'!
 
-deletePackage: packageName
-	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
-	To remove a package, use #removePackage instead."
-
-	<delete smalltalk.packages[packageName]>
+createPackage: packageName
+	"Create and bind a new bare package with given name and return it."
+	<return smalltalk.addPackage(packageName)>
 !
 
 packageAt: packageName
@@ -866,10 +866,6 @@ packages
 	<return self.packages.all()>
 !
 
-pseudoVariableNames
-	^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')
-!
-
 removePackage: packageName
 	"Removes a package and all its classes."
 
@@ -886,7 +882,7 @@ renamePackage: packageName to: newName
 	| pkg |
 	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
 	(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].
-	(self basicAt: 'packages') at: newName put: pkg.
+	(self at: 'packages') at: newName put: pkg.
 	pkg name: newName.
 	self deletePackage: packageName.
 ! !
@@ -897,17 +893,25 @@ 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.
 	
 	aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].
 	^ self createPackage: packageName
+!
+
+deleteClass: aClass
+	"Deletes a class by deleting its binding only. Use #removeClass instead"
+	
+	<self.removeClass(aClass)>
+!
+
+deletePackage: packageName
+	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
+	To remove a package, use #removePackage instead."
+
+	<delete self.packages[packageName]>
 ! !
 
 !Smalltalk methodsFor: 'testing'!
@@ -919,8 +923,6 @@ isSmalltalkObject: anObject
 	<return typeof anObject.klass !!== 'undefined'>
 ! !
 
-Smalltalk class instanceVariableNames: 'current'!
-
 !Smalltalk class methodsFor: 'accessing'!
 
 current