public Name GetDeclName(DeclReference declRef) { Name name; if (!this.declTree.FindByValue(declRef, out name)) { throw new ArgumentException("not found"); } return(name); }
public int CreateFunct(Name name) { var decl = new DeclFunct(); this.declFuncts.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Funct, index = this.declFuncts.Count - 1 }; this.declTree.Add(name, declRef); return this.declFuncts.Count - 1; }
public bool ValidateAsFunct(DeclReference decl, Name origName, Diagnostics.Span span) { if (decl.kind != Core.Session.DeclReference.Kind.Funct) { this.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.WrongDeclarationKind, "'" + this.GetDeclName(decl).GetString() + "' is not a funct", span); return(false); } return(true); }
public int CreateStruct(Name name, Grammar.ASTNodeDeclStruct declASTNode) { var decl = new DeclStruct(); decl.declASTNode = declASTNode; this.declStructs.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Struct, index = this.declStructs.Count - 1 }; this.declTree.Add(name, declRef); return this.declStructs.Count - 1; }
public int CreateFunct(Name name) { var decl = new DeclFunct(); this.declFuncts.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Funct, index = this.declFuncts.Count - 1 }; this.declTree.Add(name, declRef); return(this.declFuncts.Count - 1); }
public int CreatePrimitiveStruct(Name name) { var decl = new DeclStruct(); decl.primitive = true; decl.declASTNode = null; this.declStructs.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Struct, index = this.declStructs.Count - 1 }; this.declTree.Add(name, declRef); return this.declStructs.Count - 1; }
public int CreateStruct(Name name, Grammar.ASTNodeDeclStruct declASTNode) { var decl = new DeclStruct(); decl.declASTNode = declASTNode; this.declStructs.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Struct, index = this.declStructs.Count - 1 }; this.declTree.Add(name, declRef); return(this.declStructs.Count - 1); }
public int CreatePrimitiveStruct(Name name) { var decl = new DeclStruct(); decl.primitive = true; decl.declASTNode = null; this.declStructs.Add(decl); var declRef = new DeclReference { kind = DeclReference.Kind.Struct, index = this.declStructs.Count - 1 }; this.declTree.Add(name, declRef); return(this.declStructs.Count - 1); }
public Name GetFunctName(int functIndex) { var declRef = new DeclReference { kind = DeclReference.Kind.Funct, index = functIndex }; Name name; if (!this.declTree.FindByValue(declRef, out name)) { throw new ArgumentException("struct not found"); } return(name); }
public Name GetDeclName(DeclReference declRef) { Name name; if (!this.declTree.FindByValue(declRef, out name)) throw new ArgumentException("not found"); return name; }
public bool ValidateAsType(DeclReference decl, Name origName, Diagnostics.Span span) { if (decl.kind != Core.Session.DeclReference.Kind.Struct) { this.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.WrongDeclarationKind, "'" + this.GetDeclName(decl).GetString() + "' is not a type", span); return false; } return true; }
public Name GetStructName(int structIndex) { var declRef = new DeclReference { kind = DeclReference.Kind.Struct, index = structIndex }; Name name; if (!this.declTree.FindByValue(declRef, out name)) throw new ArgumentException("struct not found"); return name; }