diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3c157e8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +#unityDir=c:/Projects/unity/unity/build/WindowsEditor +#org.gradle.daemon=true diff --git a/src/UnityScript.Lang/UnityRuntimeServices.boo b/src/UnityScript.Lang/UnityRuntimeServices.boo index fc6636d..f2ef8cc 100755 --- a/src/UnityScript.Lang/UnityRuntimeServices.boo +++ b/src/UnityScript.Lang/UnityRuntimeServices.boo @@ -19,7 +19,7 @@ class UnityRuntimeServices: if not IsGenerator(returnValue): return returnValue if not target.GetType().IsSubclassOf(scriptBaseType): return returnValue if IsStaticMethod(target.GetType(), name, args): return returnValue - return cast(duck, target).StartCoroutine_Auto(returnValue) + return cast(duck, target).StartCoroutine(returnValue) static def GetProperty(target, name as string): assert Initialized diff --git a/src/UnityScript.Tests/EvalTestFixture.boo b/src/UnityScript.Tests/EvalTestFixture.boo index ce1c233..a0355d2 100755 --- a/src/UnityScript.Tests/EvalTestFixture.boo +++ b/src/UnityScript.Tests/EvalTestFixture.boo @@ -43,6 +43,10 @@ class EvalTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/eval/eval-in-static-function-3.js") + [Test] def eval_with_pragma_strict(): + RunTestCase("tests/eval/eval-with-pragma-strict.js") + + [Test] def functions_1(): RunTestCase("tests/eval/functions-1.js") diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo index 842f17f..f9aa7d8 100644 --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -91,7 +91,7 @@ class MonoBehaviour(Component): [getter(transform)] m_Transform = Transform() - def StartCoroutine_Auto(routine as IEnumerator): + def StartCoroutine(routine as IEnumerator): print("Received coroutine") routine.MoveNext() return routine.Current diff --git a/src/UnityScript.Tests/StackTraceTestFixture.boo b/src/UnityScript.Tests/StackTraceTestFixture.boo index c5eb41a..3b4a182 100755 --- a/src/UnityScript.Tests/StackTraceTestFixture.boo +++ b/src/UnityScript.Tests/StackTraceTestFixture.boo @@ -3,6 +3,7 @@ namespace UnityScript.Tests import NUnit.Framework [TestFixture] +[Category("FailsOnMono")] partial class StackTraceTestFixture(AbstractIntegrationTestFixture): override def ExecuteScript(type as System.Type): try: @@ -32,4 +33,4 @@ partial class StackTraceTestFixture(AbstractIntegrationTestFixture): def lines(s as string): for line in /\n/.Split(s): line = line.Trim() - if len(line) > 0: yield line \ No newline at end of file + if len(line) > 0: yield line diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo index dbdc0ae..4ac7621 100755 --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -18,13 +18,13 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): private $domainField as $EvaluationDomain - def GetEvaluationDomain(): + public def GetEvaluationDomain(): return $domainField or ($domainField = $EvaluationDomain()) - def GetImports(): + public def GetImports(): return $(ImportsArrayFor(node)) - def GetAssemblyReferences(): + public def GetAssemblyReferences(): return $(AssemblyReferencesArray()) |] diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 68ec27a..d34577e 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -20,8 +20,8 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): deferred IEnumerator_get_Current = typeof(System.Collections.IEnumerator).GetProperty("Current").GetGetMethod(); - deferred _StartCoroutine = NameResolutionService.ResolveMethod(UnityScriptTypeSystem.ScriptBaseType, "StartCoroutine_Auto") - + deferred _StartCoroutine = NameResolutionService.ResolveMethod(UnityScriptTypeSystem.ScriptBaseType, "StartCoroutine", (typeof(System.Collections.IEnumerator),)) + deferred _UnityRuntimeServices_GetEnumerator = ResolveUnityRuntimeMethod("GetEnumerator") deferred _UnityRuntimeServices_Update = ResolveUnityRuntimeMethod("Update") @@ -40,7 +40,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): // but into: // foo.Equals(null) self.OptimizeNullComparisons = false - + def ResolveUnityRuntimeMethod(name as string): return NameResolutionService.ResolveMethod(UnityRuntimeServicesType, name) diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo index 786b6fb..8c3a528 100755 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -32,7 +32,7 @@ class UnityScriptCompilerFactory: compiler.Parameters.OutputAssembly = options.Output for define in options.Defines: - compiler.Parameters.Defines.Add(define, define) + compiler.Parameters.Defines[define] = define compiler.Parameters.OutputType = options.OutputType diff --git a/tests/eval/eval-with-pragma-strict.js b/tests/eval/eval-with-pragma-strict.js new file mode 100644 index 0000000..ed66fdb --- /dev/null +++ b/tests/eval/eval-with-pragma-strict.js @@ -0,0 +1,10 @@ +/* +foo +*/ +#pragma strict +function evalPrint() { + var value = "foo"; + return eval("value"); +} + +print(evalPrint()); \ No newline at end of file diff --git a/tests/semantics/coroutine.js b/tests/semantics/coroutine.js index 219d24e..8e4ca71 100644 --- a/tests/semantics/coroutine.js +++ b/tests/semantics/coroutine.js @@ -7,7 +7,7 @@ partial public class coroutine(UnityScript.Tests.MonoBehaviour): return coroutine.$spam$2().GetEnumerator() public virtual def Awake() as void: - enumerate = self.StartCoroutine_Auto(self.spam()) + enumerate = self.StartCoroutine(self.spam()) $iterator$1 = UnityScript.Lang.UnityRuntimeServices.GetEnumerator(enumerate) while $iterator$1.MoveNext(): e = $iterator$1.get_Current()