Forráskód Böngészése

Merge pull request #440 from herby/gh-438

Fixes #438
Nicolas Petton 12 éve
szülő
commit
d747c059e0

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 214 - 107
js/Compiler-IR.deploy.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 214 - 107
js/Compiler-IR.js


+ 12 - 0
js/Compiler-Tests.deploy.js

@@ -424,6 +424,18 @@ return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},smalltalk.Cod
 messageSends: ["should:return:"]}),
 smalltalk.CodeGeneratorTest);
 
+smalltalk.addMethod(
+"_testBackslashSelectors",
+smalltalk.method({
+selector: "testBackslashSelectors",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._should_return_("\x5c arg ^ 4",(4));
+_st(self)._should_return_("\x5c\x5c arg ^ 42",(42));
+return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},smalltalk.CodeGeneratorTest)})},
+messageSends: ["should:return:"]}),
+smalltalk.CodeGeneratorTest);
+
 smalltalk.addMethod(
 "_testBlockReturn",
 smalltalk.method({

+ 17 - 0
js/Compiler-Tests.js

@@ -574,6 +574,23 @@ referencedClasses: []
 }),
 smalltalk.CodeGeneratorTest);
 
+smalltalk.addMethod(
+"_testBackslashSelectors",
+smalltalk.method({
+selector: "testBackslashSelectors",
+category: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._should_return_("\x5c arg ^ 4",(4));
+_st(self)._should_return_("\x5c\x5c arg ^ 42",(42));
+return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},smalltalk.CodeGeneratorTest)})},
+args: [],
+source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+smalltalk.CodeGeneratorTest);
+
 smalltalk.addMethod(
 "_testBlockReturn",
 smalltalk.method({

+ 2 - 14
js/Kernel-Objects.deploy.js

@@ -1829,9 +1829,9 @@ messageSends: []}),
 smalltalk.Number);
 
 smalltalk.addMethod(
-"__backslash",
+"__backslash_backslash",
 smalltalk.method({
-selector: "\x5c",
+selector: "\x5c\x5c",
 fn: function (aNumber){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
return self % aNumber;
@@ -1839,18 +1839,6 @@ return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smal
 messageSends: []}),
 smalltalk.Number);
 
-smalltalk.addMethod(
-"__backslash_backslash",
-smalltalk.method({
-selector: "\x5c\x5c",
-fn: function (aNumber) {
-    var self = this;
-    return self % aNumber;
-    return self;
-},
-messageSends: []}),
-smalltalk.Number);
-
 smalltalk.addMethod(
 "_abs",
 smalltalk.method({

+ 2 - 19
js/Kernel-Objects.js

@@ -2554,9 +2554,9 @@ referencedClasses: []
 smalltalk.Number);
 
 smalltalk.addMethod(
-"__backslash",
+"__backslash_backslash",
 smalltalk.method({
-selector: "\x5c",
+selector: "\x5c\x5c",
 category: 'arithmetic',
 fn: function (aNumber){
 var self=this;
@@ -2569,23 +2569,6 @@ referencedClasses: []
 }),
 smalltalk.Number);
 
-smalltalk.addMethod(
-"__backslash_backslash",
-smalltalk.method({
-selector: "\x5c\x5c",
-category: 'arithmetic',
-fn: function (aNumber) {
-    var self = this;
-    return self % aNumber;
-    return self;
-},
-args: ["aNumber"],
-source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Number);
-
 smalltalk.addMethod(
 "_abs",
 smalltalk.method({

+ 1 - 1
st/Compiler-IR.st

@@ -1137,7 +1137,7 @@ nextPutIfElse: aBlock with: ifBlock with: elseBlock
 nextPutMethodDeclaration: aMethod with: aBlock
 	stream
 		nextPutAll: 'smalltalk.method({'; lf;
-		nextPutAll: 'selector: "', aMethod selector, '",'; lf;
+		nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;
 		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.
 	aBlock value.
 	stream

+ 6 - 0
st/Compiler-Tests.st

@@ -252,6 +252,12 @@ testAssignment
 	self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1
 !
 
+testBackslashSelectors
+	
+	self should: '\ arg ^ 4' return: 4.
+	self should: '\\ arg ^ 42' return: 42
+!
+
 testBlockReturn
 	self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).
 	self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).

+ 0 - 4
st/Kernel-Objects.st

@@ -845,10 +845,6 @@ identityHash
 	<return self % aNumber>
 !
 
-\\ aNumber
-	<return self % aNumber>
-!
-
 abs
 	<return Math.abs(self);>
 !

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott