/**
* description
*
* longer
* description
*
* @author The Author
* @throws Exception if this
* or that happens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets a robust enumerator for the IEnumerable. A robust enumerator will function even when the collection is modified while enumerating. | |
/// </summary> | |
/// <typeparam name="T">The type.</typeparam> | |
/// <param name="coll">The collection.</param> | |
/// <param name="lookBehind">If <code>true</code>, elements inserted before the current element will still be returned.</param> | |
/// <returns>An IEnumerable that will not throw an IllegalOperationException if the underlying collection is modified.</returns> | |
public static IEnumerable<T> AsRobustEnumerable<T>(this IEnumerable<T> coll, bool lookBehind = false) where T : class | |
{ | |
HashSet<T> alreadyReturned = new HashSet<T>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir data/frames 2> /dev/null # create the images folder, but don't show an error message if it already exists | |
set i=1; # counter | |
set filename=; # file name, not used yet | |
i=1; # actually initialize counter | |
curl --silent geekwagon.net/projects/xkcd1190/data/data.txt | \ | |
while read line; do # for each line in data.txt, do the following: | |
line=`echo $line | tr -d ' '`; # remove all spaces | |
if [ ! "$line" = "" ]; then # check that line is not empty | |
filename="data/frames/$i.png"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ceylon-dist, including ceylon-common, ceylon-compiler, ceylon-js, ceylon-module-resolver, ceylon-runtime, ceylon-spec and ceylon.language | |
cd ceylon-dist | |
echo "$0: Updating ceylon-dist" | |
printf "%$(tput cols)s\n" | tr ' ' '=' | |
ant update-all publish-all | |
echo -e '\nDone.\n' | |
cd .. | |
# ceylon-sdk | |
cd ceylon-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /tmp | |
cat > tmp.c <<EOF | |
#include <stdio.h> | |
int main() { | |
char str[4096]; | |
fgets(str, 4096, stdin); | |
printf("%s\n", str); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tmp; | |
@.com.redhat.ceylon.compiler.java.metadata.Ceylon(major = 6) | |
@.com.redhat.ceylon.compiler.java.metadata.Method | |
final class foo_ { | |
private foo_() { | |
} | |
@.com.redhat.ceylon.compiler.java.metadata.TypeInfo("ceylon.language::Anything") |
Take this Ceylon code:
{ for (x in foo) if (bar) for (y in baz) op(x, y) }
The compiler generates an anonymous AbstractIterable
class for this with a chain of boolean
"has thing" methods:
next()
(the only non-boolean
method) callsy()
to get the next element, if possibley()
checks$iterator$2
to request an iterator forbaz
, then gets the next item – if it exists,y
is set, elsey$exhausted$
is set$iterator$2()
checks if thex
iterator isn’t exhausted, if they
iterator exists and if it doesn’t, checks$next$1()
to see if it should generate another iterator$next$1()
checksx()
to see if it should even check the expression, then checks the expression (I abbreviated it below tobar
)x()
checks if the "root" iterator isn’t exhausted, and setsx
in that case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Ceylon.g b/Ceylon.g | |
index 1ef1226..3dee8ef 100644 | |
--- a/Ceylon.g | |
+++ b/Ceylon.g | |
@@ -1848,7 +1848,9 @@ anonymousFunction returns [Expression expression] | |
comprehension returns [Comprehension comprehension] | |
@init { $comprehension = new Comprehension(null); } | |
: forComprehensionClause | |
- { $comprehension.setForComprehensionClause($forComprehensionClause.comprehensionClause); } | |
+ { $comprehension.setInitialComprehensionClause($forComprehensionClause.comprehensionClause); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java b/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
index c95c00a..f4d815a 100755 | |
--- a/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
+++ b/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
@@ -4597,6 +4597,8 @@ public class ExpressionTransformer extends AbstractTransformer { | |
if (transformedCond.hasResultDecl()) { | |
fields.add(make().VarDef(make().Modifiers(Flags.PRIVATE), | |
resultVarName.asName(), transformedCond.makeTypeExpr(), null)); | |
+ valueCaptures.add(make().VarDef(make().Modifiers(Flags.FINAL), | |
+ resultVarName.asName(), transformedCond.makeTypeExpr(), resultVarName.makeIdentWithThis())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java b/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
index f4d815a..3a54ba6 100755 | |
--- a/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
+++ b/src/com/redhat/ceylon/compiler/java/codegen/ExpressionTransformer.java | |
@@ -1401,7 +1401,7 @@ public class ExpressionTransformer extends AbstractTransformer { | |
public JCExpression comprehensionAsSequential(Tree.Comprehension comprehension, ProducedType expectedType) { | |
JCExpression sequential = iterableToSequential(transformComprehension(comprehension)); | |
- ProducedType elementType = comprehension.getForComprehensionClause().getTypeModel(); | |
+ ProducedType elementType = comprehension.getInitialComprehensionClause().getTypeModel(); |
OlderNewer