diff options
| author | j-p <jp.bruyere@live.be> | 2016-08-11 04:20:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-11 04:20:36 +0200 |
| commit | 81eb8c7a75ffbe8b6740b2a84a9ebff75da9b393 (patch) | |
| tree | 3225277358a2bba61c4496923ba39353c942098b /src/CompilerServices/Bindings.cs | |
| parent | 4d4a9116ea5c68b27f0b7c43db9682ab57738ae7 (diff) | |
| parent | 7560c0bb4a769210e289e2633ddf13d2617f8e6e (diff) | |
Merge pull request #18 from jpbruyere/BindingImprovement
Instantiator
Diffstat (limited to 'src/CompilerServices/Bindings.cs')
| -rw-r--r-- | src/CompilerServices/Bindings.cs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/CompilerServices/Bindings.cs b/src/CompilerServices/Bindings.cs index 8ece856c..64f412f6 100644 --- a/src/CompilerServices/Bindings.cs +++ b/src/CompilerServices/Bindings.cs @@ -41,6 +41,11 @@ namespace Crow public string DynMethodId { get { return dynMethodId; } } + public Type SourceType { + get { return Source == null ? null + : Source.Instance == null ? null + : Source.Instance.GetType();} + } public bool Resolved { get { return resolved; } @@ -123,10 +128,12 @@ namespace Crow //datasource binding object dataSource = (Source.Instance as GraphicObject).DataSource; if (dataSource == null) { + #if DEBUG_BINDING Debug.WriteLine ("\tDataSource is null => " + this.ToString()); + #endif return false; } - + Target = new MemberReference (dataSource); memberName = bindingExp [0]; } else { @@ -148,7 +155,7 @@ namespace Crow while (ptr < bindingExp.Length - 1) { if (tmpTarget == null) { #if DEBUG_BINDING - Debug.WriteLine ("\tERROR: target not found => " + this.ToString()); + Debug.WriteLine ("\tTarget not found => " + this.ToString()); #endif return false; } @@ -164,14 +171,12 @@ namespace Crow } if (tmpTarget == null) { -#if DEBUG_BINDING - Debug.WriteLine ("\tERROR: Binding Target not found => " + this.ToString()); -#endif + #if DEBUG_BINDING + Debug.WriteLine ("\tBinding Target not found => " + this.ToString()); + #endif return false; } - Target = new MemberReference (tmpTarget); - string [] bindTrg = bindingExp [ptr].Split ('.'); if (bindTrg.Length == 1) @@ -182,6 +187,14 @@ namespace Crow } else throw new Exception ("Syntax error in binding, expected 'go dot member'"); + if (tmpTarget == null) { + #if DEBUG_BINDING + Debug.WriteLine ("\tBinding Target not found => " + this.ToString()); + #endif + return false; + } + + Target = new MemberReference (tmpTarget); } if (Target.TryFindMember (memberName)) { |