Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added synchronize function. This function synchronizes the code ran in the closure with any other thread that has called the synchronize(name, closure) function using the same name String (by value). For more info, read _synchronized.docs(). * synchronized() improvements. - Changed syntax from synchronized(CString, CClosure) to synchronized(Construct, <code>). - Allow CArrays to synchronize by reference. - Allow non-CString Constructs (except for CNull) to be used as values for synchronization (Construct.val()). * Added synchronized keyword for new syntax support. Added syntax support for: synchronized(@syncObj) { code } --> synchronized(@syncObject, code) * Added example to synchronized(). Added an example. * Make synchronized return void. Instead of returning the evals() of the code inside, return void. * Added readibility to synchronized() examples. More lines, more pleasure for the human eye.
- Loading branch information
1 parent
6ed1976
commit 73516fe
Showing
2 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/com/laytonsmith/core/compiler/keywords/SynchronizedKeyword.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.laytonsmith.core.compiler.keywords; | ||
|
||
import com.laytonsmith.core.compiler.Keyword; | ||
|
||
/** | ||
* A handler that changes synchronized(arg) { code } format to synchronized(arg, code). | ||
* @author Pieter12345 | ||
*/ | ||
@Keyword.keyword("synchronized") | ||
public class SynchronizedKeyword extends SimpleBlockKeywordFunction { | ||
|
||
@Override | ||
protected Integer[] getFunctionArgumentCount() { | ||
return new Integer[]{1}; | ||
} | ||
|
||
} |
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