Skip to content

Commit

Permalink
use obj.$ method for a kind error message
Browse files Browse the repository at this point in the history
- fix code
- build v0.0.42
  • Loading branch information
mohayonao committed Jun 11, 2014
1 parent f08061b commit 14bc5a7
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 96 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scscript",
"version": "0.0.41",
"version": "0.0.42",
"author": "Nao Yonamine <mohayonao@gmail.com>",
"homepage": "http://mohayonao.github.io/SCScript/",
"bugs": "https://github.com/mohayonao/SCScript/issues",
Expand Down
4 changes: 2 additions & 2 deletions src/sc/classlib/Collections/Array.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ SCScript.install(function(sc) {
spec.shift = fn(function($n, $filler) {
var $fill, $remain;

$fill = SCArray.fill($n.abs(), $filler);
$remain = this.drop($n.neg());
$fill = SCArray.fill($n.$("abs"), $filler);
$remain = this.drop($n.$("neg"));

if ($n < 0) {
return $remain ["++"] ($fill);
Expand Down
12 changes: 6 additions & 6 deletions src/sc/classlib/Collections/ArrayedCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ SCScript.install(function(sc) {
}, "index; function");

spec.atInc = fn(function($index, $inc) {
this.put($index, this.at($index) ["+"] ($inc));
this.put($index, this.at($index).$("+", [ $inc ]));
return this;
}, "index; inc=1");

spec.atDec = fn(function($index, $dec) {
this.put($index, this.at($index) ["-"] ($dec));
this.put($index, this.at($index).$("-", [ $dec ]));
return this;
}, "index; dec=1");

Expand Down Expand Up @@ -541,7 +541,7 @@ SCScript.install(function(sc) {

for (i = 0, imax = this._.length; i < imax; ++i) {
this.put($.Integer(i), $start);
$start = $start ["+"] ($step);
$start = $start.$("+", [ $step ]);
}

return this;
Expand Down Expand Up @@ -613,7 +613,7 @@ SCScript.install(function(sc) {
$minItem = this.minItem();
$maxItem = this.maxItem();
return this.collect($.Function(function($el) {
return $el.linlin($minItem, $maxItem, $min, $max);
return $el.$("linlin", [ $minItem, $maxItem, $min, $max ]);
}));
}, "min=0.0; max=1.0");

Expand All @@ -631,7 +631,7 @@ SCScript.install(function(sc) {
};

spec.shape = function() {
return $.Array([ this.size() ]) ["++"] (this.at($int_0).shape());
return $.Array([ this.size() ]) ["++"] (this.at($int_0).$("shape"));
};

spec.reshape = function() {
Expand Down Expand Up @@ -720,7 +720,7 @@ SCScript.install(function(sc) {

cuts = $$cuts._.slice(1);
return $list.collect($.Function(function($item) {
return $item.slice.apply($item, cuts);
return $item.$("slice", cuts);
})).unbubble();
}, "*cuts");

Expand Down
4 changes: 2 additions & 2 deletions src/sc/classlib/Collections/Association.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SCScript.install(function(sc) {

spec["=="] = function($anAssociation) {
if ($anAssociation.key) {
return this._$key ["=="] ($anAssociation.key());
return this._$key ["=="] ($anAssociation.$("key"));
}
return $false;
};
Expand All @@ -52,7 +52,7 @@ SCScript.install(function(sc) {
};

spec["<"] = function($anAssociation) {
return this._$key ["<"] ($anAssociation.key());
return this._$key.$("<", [ $anAssociation.$("key") ]);
};

// TODO: implements printOn
Expand Down
22 changes: 11 additions & 11 deletions src/sc/classlib/Collections/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SCScript.install(function(sc) {
var fillND = function($this, $dimensions, $function, $args) {
var $n, $obj, $argIndex;

$n = $dimensions.first();
$n = $dimensions.$("first");
$obj = $this.new($n);
$argIndex = $args.size();
$args = $args ["++"] ($int_0);
Expand All @@ -115,7 +115,7 @@ SCScript.install(function(sc) {
$obj.add($function.valueArray($args.put($argIndex, $i)));
}));
} else {
$dimensions = $dimensions.drop($int_1);
$dimensions = $dimensions.$("drop", [ $int_1 ]);
$n.do($.Function(function($i) {
$obj = $obj.add(fillND($this, $dimensions, $function, $args.put($argIndex, $i)));
}));
Expand All @@ -142,7 +142,7 @@ SCScript.install(function(sc) {
return $false;
}
this.do($.Function(function($item) {
if (!$aCollection.includes($item).__bool__()) {
if (!$aCollection.$("includes", [ $item ]).__bool__()) {
$res = $false;
return sc.C.LOOP_BREAK;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ SCScript.install(function(sc) {

spec.flatSize = function() {
return this.sum($.Function(function($_) {
return $_.flatSize();
return $_.$("flatSize");
}));
};

Expand Down Expand Up @@ -220,7 +220,7 @@ SCScript.install(function(sc) {

spec.removeEvery = fn(function($list) {
this.removeAllSuchThat($.Function(function($_) {
return $list.includes($_);
return $list.$("includes", [ $_ ]);
}));
return this;
}, "list");
Expand All @@ -243,9 +243,9 @@ SCScript.install(function(sc) {
spec.atAll = fn(function($keys) {
var $this = this;

return $keys.collect($.Function(function($index) {
return $keys.$("collect", [ $.Function(function($index) {
return $this.at($index);
}));
}) ]);
}, "keys");

spec.putEach = fn(function($keys, $values) {
Expand Down Expand Up @@ -841,9 +841,9 @@ SCScript.install(function(sc) {
return this.species().new();
}
if ($axis !== $nil) {
$index = $axis ["*"] ($.Integer(2));
$index = $axis.$("*", [ $.Integer(2) ]);
} else {
$index = this.minItem() ["+"] (this.maxItem());
$index = this.minItem().$("+", [ this.maxItem() ]);
}

return $index ["-"] (this);
Expand All @@ -854,7 +854,7 @@ SCScript.install(function(sc) {

$result = this.species().new();
this.do($.Function(function($item) {
if ($that.includes($item).__bool__()) {
if ($that.$("includes", [ $item ]).__bool__()) {
$result = $result.add($item);
}
}));
Expand Down Expand Up @@ -898,7 +898,7 @@ SCScript.install(function(sc) {
}, "that");

spec.isSubsetOf = fn(function($that) {
return $that.includesAll(this);
return $that.$("includesAll", [ this ]);
}, "that");

spec.asArray = function() {
Expand Down
18 changes: 9 additions & 9 deletions src/sc/classlib/Collections/Dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ SCScript.install(function(sc) {
var $newCollection;

$newCollection = this.new($aCollection.size());
$aCollection.keysValuesDo($.Function(function($k, $v) {
$aCollection.$("keysValuesDo", [ $.Function(function($k, $v) {
$newCollection.put($k, $v);
}));
}) ]);

return $newCollection;
}, "aCollection");
Expand Down Expand Up @@ -85,7 +85,7 @@ SCScript.install(function(sc) {
}, "key");

spec.add = fn(function($anAssociation) {
this.put($anAssociation.key(), $anAssociation.value());
this.put($anAssociation.$("key"), $anAssociation.$("value"));
return this;
}, "anAssociation");

Expand Down Expand Up @@ -125,9 +125,9 @@ SCScript.install(function(sc) {
spec.putPairs = fn(function($args) {
var $this = this;

$args.pairsDo($.Function(function($key, $val) {
$args.$("pairsDo", [ $.Function(function($key, $val) {
$this.put($key, $val);
}));
}) ]);

return this;
}, "args");
Expand Down Expand Up @@ -454,11 +454,11 @@ SCScript.install(function(sc) {

$assoc = $nil;
this.keysValuesDo($.Function(function($key, $val) {
$assoc = $assoc.add($key ["->"] ($val));
$assoc = $assoc.add($key.$("->", [ $val ]));
}));

return $assoc.sort($func).collect($.Function(function($_) {
return $_.key();
return $_.$("key");
}));
}, "func");

Expand All @@ -482,7 +482,7 @@ SCScript.install(function(sc) {
};

spec.transformEvent = fn(function($event) {
return $event.putAll(this);
return $event.$("putAll", [ this ]);
}, "event");

// TODO: implements embedInStream
Expand All @@ -497,7 +497,7 @@ SCScript.install(function(sc) {
for (i = j = 0, imax = array.length; i < imax; i += 2, ++j) {
$key = array[i];
if ($key !== $nil) {
$val = $argArray.at($.Integer(i + 1));
$val = $argArray.$("at", [ $.Integer(i + 1) ]);
$function.value($key, $val, $.Integer(j));
}
}
Expand Down
Loading

0 comments on commit 14bc5a7

Please sign in to comment.