Skip to content

Commit

Permalink
Work on the DependentProperties debugging staff.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladD2 committed Oct 8, 2017
1 parent 88a0552 commit 3bb393b
Show file tree
Hide file tree
Showing 38 changed files with 202 additions and 44 deletions.
Binary file removed Boot1/Net-4.0/DotNetLang.Boot81.dll
Binary file not shown.
Binary file added Boot1/Net-4.0/DotNetLang.Boot86.dll
Binary file not shown.
Binary file modified Boot1/Net-4.0/Nitra.Compiler.dll
Binary file not shown.
Binary file modified Boot1/Net-4.0/Nitra.Grammar.dll
Binary file not shown.
Binary file removed Boot1/Net-4.0/Nitra.Runtime.Boot81.dll
Binary file not shown.
Binary file added Boot1/Net-4.0/Nitra.Runtime.Boot86.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Boot1/version.xml
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Version>82</Version>
<Version>87</Version>
6 changes: 3 additions & 3 deletions Boot2/DotNetLang/Collectors/BaseTypeReferenceSet.n
@@ -1,4 +1,4 @@
using Nitra;
using Nitra;
using Nitra.Declarations;
using Nitra.Serialization2;
using Nitra.Staging;
Expand Down Expand Up @@ -117,8 +117,8 @@ namespace DotNet

foreach (type in _parentTypes)
{
| SupportsInheritanceTypeSymbol(BaseTypeSet = parentTypeSet, MemberTable = symbolScope) as symbol
| ConstructedTypeSymbol(IsTypeInfoEvaluated = true, TypeInfo = GenericContainerTypeSymbol(BaseTypeSet = parentTypeSet, MemberTable = symbolScope) as symbol) =>
| SupportsInheritanceTypeSymbol(IsBaseTypeSetEvaluated=true, IsMemberTableEvaluated=true, BaseTypeSet=parentTypeSet, MemberTable=symbolScope) as symbol
| ConstructedTypeSymbol(IsTypeInfoEvaluated=true, TypeInfo=GenericContainerTypeSymbol(IsBaseTypeSetEvaluated=true, IsMemberTableEvaluated=true, BaseTypeSet=parentTypeSet, MemberTable=symbolScope) as symbol) =>
// TODO: need subst of type parameters
ancestorTypes.UnionWith(parentTypeSet.AncestorTypes);

Expand Down
4 changes: 2 additions & 2 deletions Boot2/DotNetLang/Properties/AssemblyInfo.Version.n
@@ -1,4 +1,4 @@

[assembly: System.Reflection.AssemblyVersionAttribute("0.83.0.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.83.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.88.0.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.88.0.0")]

5 changes: 4 additions & 1 deletion Boot2/DotNetLang/Type/ConstructedTypeDeclaration.n
@@ -1,4 +1,4 @@
using Nitra.ProjectSystem;
using Nitra.ProjectSystem;
using Nitra.Declarations;

using Nemerle;
Expand Down Expand Up @@ -47,6 +47,9 @@ namespace Nitra.Declarations
set { IgnoreParams(); throw NotImplementedException() }
}

public ContainingTable_Location : string * int * int { get; set; }
public Symbol_Location : string * int * int { get; set; }

public override IsParsed : bool { get { true } } // ???

public override CreateSymbol() : DeclarationSymbol
Expand Down
9 changes: 8 additions & 1 deletion Boot2/Nitra.Compiler/Generation/Ast/AbstractAstEmitter.n
@@ -1,4 +1,4 @@
using Nitra.Model;
using Nitra.Model;
using Nitra.Typing;

using Nemerle;
Expand Down Expand Up @@ -197,6 +197,13 @@ namespace Nitra.Compiler
}
]>);

_ambiguousTb.Define(<[ decl:
public $(symbol.Name + "_Location" : usesite) : string * int * int
{
get; set;
}
]>);

DefineDependenPropertyOverrideSetter(_ambiguousTb, symbol);
}

Expand Down
@@ -1,4 +1,4 @@
using Nitra.Runtime.GraphUtils;
using Nitra.Runtime.GraphUtils;
using Nitra.Typing;
using Nitra.Model;

Expand All @@ -13,6 +13,7 @@ using Nemerle.Utility;
using Nemerle.Surround;

using System;
using System.IO;
using System.Linq;
using SCG = System.Collections.Generic;

Expand Down Expand Up @@ -651,7 +652,16 @@ namespace Nitra.Compiler
| Assign(code) =>
def (predicate, checkedPaths) = makeIsEvaluatedCheck(node.Path, dependentProperties);
def (properties, collectorProperties) = collectDependendOn(node, checkedPaths);
def expr1 = Util.locate(code.Location, <[ $(CompilePath(node.Path)) = $(compileCode(node.DeclaredIn, code)); context.CalculatedCountInc(); ]>);
def file = Path.Combine(Path.GetDirectoryName(tb.Manager.Options.ProjectPath), code.Location.File);
when (Path.GetExtension(file).Equals(".dll", StringComparison.OrdinalIgnoreCase))
{
assert2(true);
}
def line = code.Location.Line;
def col = code.Location.Column;
def locCode = Util.locate(code.Location, <[ $(CompileLocationPath(node.Path)) = ($file, $line, $col); ]>);
//def locCode = <[ () ]>;
def expr1 = Util.locate(code.Location, <[ $(CompilePath(node.Path)) = $(compileCode(node.DeclaredIn, code)); context.CalculatedCountInc(); $locCode; ]>);
def expr2 = makeCondition(properties, collectorProperties, expr1, <[ context.DeferredCountInc() ]>);
def expr3 = TryAddStageCheck(node.Path, expr2);
def expr4 = <[ when ($predicate) $expr3; ]>;
Expand Down
30 changes: 29 additions & 1 deletion Boot2/Nitra.Compiler/Generation/Ast/BaseAstEmitter.n
@@ -1,4 +1,4 @@
using Nitra.Typing;
using Nitra.Typing;
using Nitra.Model;

using Nemerle;
Expand Down Expand Up @@ -34,12 +34,24 @@ namespace Nitra.Compiler

protected DefineInterfaceDependentProperty(propertySymbol : DependentPropertySymbol, tb : TypeBuilder, isOverride : bool) : void
{
when (propertySymbol.FullName == "DotNet.QualifiedReference.Scope")
{
assert2(true);
}

when (propertySymbol.FullName == "Nitra.Declarations.BindableAst.Scope")
{
assert2(true);
}

def propertyType = TypeCompiler.CompileDependentPropertyType(propertySymbol);
def attribute = MakePropertyAttribute(propertySymbol);
def mods = AttributesAndModifiers(if (isOverride) NemerleModifiers.New else NemerleModifiers.None, [attribute]);
tb.Define(<[ decl: ..$mods $(propertySymbol.Name : usesite) : $(propertyType : typed) { get; set; } ]>);
unless (isOverride)
tb.Define(<[ decl: $(GetIsEvaluatedPropertyName(propertySymbol) : usesite) : bool { get; } ]>);
unless (isOverride)
tb.Define(<[ decl: $(propertySymbol.Name + "_Location" : usesite) : string * int * int { get; set; } ]>);
}

protected DefineDependentProperty(tb : TypeBuilder, symbol : DependentPropertySymbol, bit : BitField, mask : int, modifiers : NemerleModifiers, acceptVisitorBody : SCG.List[PExpr], overrideSetter : bool = true) : void
Expand Down Expand Up @@ -82,6 +94,13 @@ namespace Nitra.Compiler
}
]>);

tb.Define(<[ decl:
..$isEvaluatedMods $(symbol.Name + "_Location" : usesite) : string * int * int
{
get; set;
}
]>);

when (acceptVisitorBody : object != null && propertyType.TryRequire(Environment.IRefTypeVar))
acceptVisitorBody.Add(<[ when ($(bit.Read())) visitor.Visit(this.$(backingFieldName : usesite)); ]>);

Expand Down Expand Up @@ -358,6 +377,15 @@ namespace Nitra.Compiler
| SimpleProperty(path, name) => <[ $(CompilePath(path)).$(name : usesite) ]>
}

public static CompileLocationPath(path : DependencyPath) : PExpr
{
match (CompilePath(path))
{
| <[ $parent.$(prop : name) ]> => <[ $parent.$(prop.Id + "_Location" : usesite) ]>
| x => assert2(false); x
}
}

protected static TryAddStageCheck(path : DependencyPath, expr : PExpr) : PExpr
{
if (path is DeclaredProperty(_, DependentPropertySymbol(Stage = propertyStage, /*Direction = DependentPropertyDirection.Out*/), _) when propertyStage > 0)
Expand Down
9 changes: 8 additions & 1 deletion Boot2/Nitra.Compiler/Generation/Ast/CollectionAstEmitter.n
@@ -1,4 +1,4 @@
using Nitra.Typing;
using Nitra.Typing;
using Nitra.Model;

using Nemerle;
Expand Down Expand Up @@ -134,6 +134,13 @@ namespace Nitra.Compiler
get { this.Ambiguities[0].$(isEvaluatedName : usesite) }
}
]>);

tb.Define(<[ decl:
..$isEvaluatedMods $(symbol.Name + "_Location" : usesite) : string * int * int
{
get; set;
}
]>);
}

public Emit() : void
Expand Down
9 changes: 8 additions & 1 deletion Boot2/Nitra.Compiler/Generation/Ast/SimpleAstEmitter.n
@@ -1,4 +1,4 @@
using Nitra.Model;
using Nitra.Model;
using Nitra.Typing;

using Nemerle;
Expand Down Expand Up @@ -277,6 +277,13 @@ namespace Nitra.Compiler
}
}
]>);

tb.Define(<[ decl:
..$isEvaluatedMods $(symbol.Name + "_Location" : usesite) : string * int * int
{
get; set;
}
]>);
}

private CompileProjection(properties : SCG.List[ProjectedPropertySymbol], result : SCG.List[PExpr]) : void
Expand Down
4 changes: 2 additions & 2 deletions Boot2/Nitra.Grammar/AST/Members/Ast.nitra
@@ -1,4 +1,4 @@
using DotNet;
using DotNet;

using Nitra.Typing;
using Nitra.AstUtils;
Expand All @@ -14,13 +14,13 @@ namespace Nitra.Ast
{
Kind = (if (IsAbstract) "abstract " else null) + if (IsDeclaration) "declaration" else "ast";
SpanClass = NitraLang.AstSpanClass;
Scope = BaseTypeSet.ParentFullScope.HideWith(MemberTable);

in IsDeclaration : bool;
in IsAbstract : bool;
in Cardinality : AstCardinality;
}

Symbol.Scope = Symbol.BaseTypeSet.ParentFullScope.HideWith(Symbol.MemberTable);
Symbol.BaseTypeSet |= AstUtils.FilterResolvedAstType(TypeBase.Ref, Symbol);
Symbol.BaseTypeSet |= AstUtils.GetImplicitBaseTypeForDeclaration(context, Symbol, TypeBase.Ref);
TypeBase.Scope = Scope;
Expand Down
4 changes: 2 additions & 2 deletions Boot2/Nitra.Grammar/NitraSyntax.nitra
@@ -1,4 +1,4 @@
using Nitra;
using Nitra;
using Nitra.Utils;
using Nitra.Model;
using Nitra.ProjectSystem;
Expand Down Expand Up @@ -53,7 +53,7 @@ syntax module NitraSyntax : NitraLang

extend token IgnoreToken
{
| SpaceToken = Spaces;
| [SplitAtCompletionPosition] SpaceToken = Spaces;
}

token Text = !Keyword At="@"? IdentifierBody
Expand Down
2 changes: 1 addition & 1 deletion Boot2/Nitra.Runtime/Core.nitra
@@ -1,4 +1,4 @@
namespace Nitra
namespace Nitra
{
syntax module Core
{
Expand Down
2 changes: 1 addition & 1 deletion Boot2/Nitra.Runtime/Declarations/AstBase.n
@@ -1,4 +1,4 @@
using Nitra.ProjectSystem;
using Nitra.ProjectSystem;
using Nitra.Internal;

using Nemerle;
Expand Down
13 changes: 11 additions & 2 deletions Boot2/Nitra.Runtime/Declarations/BoundedTypeVarSymbol.n
@@ -1,4 +1,4 @@
using Nitra.Internal;
using Nitra.Internal;
using Nitra.Serialization2;

using Nemerle;
Expand Down Expand Up @@ -182,11 +182,20 @@ namespace Nitra.Declarations
}
}

public BaseTypeConstraint_Location : string * int * int { get; set; }
public DerivedTypeConstraint_Location : string * int * int { get; set; }
public Type_Location : string * int * int { get; set; }
public TypeSubst_Location : string * int * int { get; set; }
public DeclaredInOpt_Location : string * int * int { get; set; }
public FullName_Location : string * int * int { get; set; }
public Kind_Location : string * int * int { get; set; }
public Scope_Location : string * int * int { get; set; }
public SpanClass_Location : string * int * int { get; set; }

get_Declarations1() : Seq[TypeVar] implements TypeVarSymbol.get_Declarations
{
GetDeclarationsOfType()
}

get_Declarations2() : Seq[Type] implements TypeSymbol.get_Declarations
{
GetDeclarationsOfType()
Expand Down
5 changes: 4 additions & 1 deletion Boot2/Nitra.Runtime/Declarations/PredefinedDeclaration.n
@@ -1,4 +1,4 @@
using Nemerle;
using Nemerle;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;
Expand Down Expand Up @@ -44,6 +44,9 @@ namespace Nitra.Declarations
_symbolFactory()
}

public ContainingTable_Location : string * int * int { get; set; }
public Symbol_Location : string * int * int { get; set; }

public override Accept(visitor : IAstVisitor) : void
{
visitor.Visit(Name);
Expand Down
@@ -1,4 +1,4 @@
using Nemerle;
using Nemerle;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace Nitra.Internal.Recovery
}
else
foreach ((nextSubrule, _) in subrules with nextIndex)
when (subrule.End == nextSubrule.Begin && state.Next.Contains(nextSubrule.State) && index != nextIndex)
when (subrule.End == nextSubrule.Begin && state.Next.Contains(nextSubrule.State) && !flattenSubrules.Contains(nextSubrule))
{
walk(nextIndex);
walkCalled = true;
Expand Down
4 changes: 2 additions & 2 deletions Boot2/Nitra.Runtime/Properties/AssemblyInfo.Version.n
@@ -1,4 +1,4 @@

[assembly: System.Reflection.AssemblyVersionAttribute("0.84.0.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.84.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.89.0.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.89.0.0")]

5 changes: 4 additions & 1 deletion Boot2/Nitra.Runtime/Serialization2/ExternalDeclaration.n
@@ -1,4 +1,4 @@
using Nitra.ProjectSystem;
using Nitra.ProjectSystem;
using Nitra.Declarations;

using Nemerle;
Expand Down Expand Up @@ -36,6 +36,7 @@ namespace Nitra.Declarations
get { __NameImpl.Symbol :> TSymbol }
set { __NameImpl.Symbol = value }
}
public Symbol_Location : string * int * int { get; set; }

set_Symbol(value : DeclarationSymbol) : void implements Declaration.set_Symbol
{
Expand All @@ -48,6 +49,7 @@ namespace Nitra.Declarations
get { assert(IsContainingTableEvaluated); _containingTable }
set { assert(!IsContainingTableEvaluated); _containingTable = value }
}
public ContainingTable_Location : string * int * int { get; set; }

public override IsParsed : bool { get { false } }

Expand All @@ -56,6 +58,7 @@ namespace Nitra.Declarations
Activator.CreateInstance.[TSymbol]()
}


public override Accept(visitor : IAstVisitor) : void
{
visitor.Visit(Name);
Expand Down
5 changes: 4 additions & 1 deletion Nitra/DotNetLang/Type/ConstructedTypeDeclaration.n
@@ -1,4 +1,4 @@
using Nitra.ProjectSystem;
using Nitra.ProjectSystem;
using Nitra.Declarations;

using Nemerle;
Expand Down Expand Up @@ -47,6 +47,9 @@ namespace Nitra.Declarations
set { IgnoreParams(); throw NotImplementedException() }
}

public ContainingTable_Location : string * int * int { get; set; }
public Symbol_Location : string * int * int { get; set; }

public override IsParsed : bool { get { true } } // ???

public override CreateSymbol() : DeclarationSymbol
Expand Down
9 changes: 8 additions & 1 deletion Nitra/Nitra.Compiler/Generation/Ast/AbstractAstEmitter.n
@@ -1,4 +1,4 @@
using Nitra.Model;
using Nitra.Model;
using Nitra.Typing;

using Nemerle;
Expand Down Expand Up @@ -197,6 +197,13 @@ namespace Nitra.Compiler
}
]>);

_ambiguousTb.Define(<[ decl:
public $(symbol.Name + "_Location" : usesite) : string * int * int
{
get; set;
}
]>);

DefineDependenPropertyOverrideSetter(_ambiguousTb, symbol);
}

Expand Down

0 comments on commit 3bb393b

Please sign in to comment.