/// <summary> /// stack pop /// </summary> /// <returns>the poped item</returns> public SqlCodeScope Pop() { var result = this.Scopes.Pop(); this.Current = this.Scopes.Peek(); return(result); }
public SqlCodeScope CreateChildDeclarationScope(string name, IScopeNameResolverContext scopeNameResolverContext) { var result = new SqlCodeScope(name, this, true, null, scopeNameResolverContext ?? this.ScopeNameResolverContext); result.Content = new SqlScope(); return(result); }
public static SqlCodeScope CreateRoot(IScopeNameResolverContext scopeNameResolverContext) { var result = new SqlCodeScope("DB", null, true, null, scopeNameResolverContext); result.Content = new SqlScope(); return(result); }
public AnalyseVisitor(SqlCodeScope dbScope) { this._DBScope = dbScope; this._AnalyseResults = new List <AnalyseResult>(); this.currentScopeRef = new SqlCodeScopeReference(); this.currentScopeRef.Set(dbScope); }
/// <summary> /// Analyse the AST /// </summary> /// <param name="node">the parsed AST / transformed.</param> /// <param name="modelDatabase">the model</param> /// <returns>think of</returns> public List <AnalyseResult> Analyse(SqlNode node, ModelSqlDatabase modelDatabase) { var scopeNameResolverContext = new ScopeNameResolverContext(modelDatabase); var dbScope = SqlCodeScope.CreateRoot(scopeNameResolverContext); var bindVisitor = new AnalyseVisitor(dbScope); bindVisitor.Logger = this.Logger; var result = bindVisitor.Run(node); return(result); }
private SqlCodeScope( string name, SqlCodeScope parent, bool isDeclaration, SqlCodeScope previous, IScopeNameResolverContext scopeNameResolverContext) { this.Name = name; this.Parent = parent; this.Previous = previous; this.IsDeclaration = isDeclaration; this.ScopeNameResolverContext = scopeNameResolverContext; }
public TypeVisitor(SqlCodeScope scope) { this.scope = scope; }
/// <summary> /// stack push /// </summary> /// <param name="next">the next scope</param> public void Push(SqlCodeScope next) { this.Scopes.Push(next); this.Current = next; }
/// <summary> /// set the stack to have one element <paramref name="dbScope"/>. /// </summary> /// <param name="dbScope">the scope to set.</param> public void Set(SqlCodeScope dbScope) { this.Scopes.Clear(); this.Scopes.Push(dbScope); this.Current = dbScope; }
public SqlCodeScope CreateNextScope(string name, IScopeNameResolverContext scopeNameResolverContext) { var result = new SqlCodeScope(name, this.Parent, false, this, scopeNameResolverContext ?? this.ScopeNameResolverContext); return(result); }
public SqlCodeScope CreateChildScope(string name, IScopeNameResolverContext scopeNameResolverContext) { var result = new SqlCodeScope(name, this, false, null, scopeNameResolverContext ?? this.ScopeNameResolverContext); return(result); }