Browse Source

#{} uses #newFromPairs:

Herbert Vojčík 10 years ago
parent
commit
d696ce15de
4 changed files with 8 additions and 7 deletions
  1. 2 2
      js/Compiler-IR.js
  2. 1 1
      st/Compiler-IR.st
  3. 3 2
      support/parser.js
  4. 2 2
      support/parser.pegjs

+ 2 - 2
js/Compiler-IR.js

@@ -2991,7 +2991,7 @@ return smalltalk.withContext(function($ctx1) {
 var $1,$2;
 $1=self._stream();
 $ctx1.sendIdx["stream"]=1;
-_st($1)._nextPutAll_("globals.HashedCollection._from_([");
+_st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
 $ctx1.sendIdx["nextPutAll:"]=1;
 _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
 return smalltalk.withContext(function($ctx2) {
@@ -3006,7 +3006,7 @@ $ctx2.sendIdx["nextPutAll:"]=2;
 _st(self._stream())._nextPutAll_("])");
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)})},
 args: ["anIRDynamicDictionary"],
-source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._from_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
+source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
 messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
 referencedClasses: []
 }),

+ 1 - 1
st/Compiler-IR.st

@@ -963,7 +963,7 @@ visitIRDynamicArray: anIRDynamicArray
 !
 
 visitIRDynamicDictionary: anIRDynamicDictionary
-	self stream nextPutAll: 'globals.HashedCollection._from_(['.
+	self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.
 		anIRDynamicDictionary instructions
 			do: [ :each | self visit: each ]
 			separatedBy: [ self stream nextPutAll: ',' ].

+ 3 - 2
support/parser.js

@@ -318,7 +318,8 @@ globals.SmalltalkParser = (function() {
                                      ._nodes_([sequence]);
                          },
         peg$c136 = function(send) { return send._selector() === "->" },
-        peg$c137 = function(send) { return send; },
+        peg$c137 = function(send) { return [send._receiver(), send._arguments()[0]]; },
+        peg$c138 = function(first, others) { return first.concat.apply(first, others); },
 
         peg$currPos          = 0,
         peg$reportedPos      = 0,
@@ -3804,7 +3805,7 @@ globals.SmalltalkParser = (function() {
         }
         if (s2 !== peg$FAILED) {
           peg$reportedPos = s0;
-          s1 = peg$c86(s1, s2);
+          s1 = peg$c138(s1, s2);
           s0 = s1;
         } else {
           peg$currPos = s0;

+ 2 - 2
support/parser.pegjs

@@ -258,8 +258,8 @@ method         = ws pattern:(keywordPattern / binaryPattern / unaryPattern) ws s
                  }
 
 
-associationSend     = send:binarySend & { return send._selector() === "->" } { return send; }
+associationSend     = send:binarySend & { return send._selector() === "->" } { return [send._receiver(), send._arguments()[0]]; }
 
 associationList = ws "." ws expression:associationSend {return expression;}
-associations    = first:associationSend others:associationList* { return [first].concat(others); }
+associations    = first:associationSend others:associationList* { return first.concat.apply(first, others); }