private static List <Edit> GetEdits(string code, FormattingOptions options, JsAst ast, bool onEnter = false) { var visitor = new FormattingVisitor(code, ast, options, onEnter); visitor.Format(ast); return(visitor.Edits); }
public void UpdateTree(JsAst newAst, IAnalysisCookie newCookie) { lock (this) { if (_updatesPending > 0) { _updatesPending--; } if (newAst == null) { // there was an error in parsing, just let the waiter go... if (_curWaiter != null) { _curWaiter.Set(); } _tree = null; return; } _tree = newAst; _cookie = newCookie; if (_curWaiter != null) { _curWaiter.Set(); } } OnNewParseTree(this, EventArgs.Empty); }
public void GetTreeAndCookie(out JsAst tree, out IAnalysisCookie cookie) { lock (this) { tree = _tree; cookie = _cookie; } }
/// <summary> /// Gets the index in the file/buffer that this scope starts at. This is the index which includes /// the definition it's self (e.g. def fob(...) or class fob(...)). /// </summary> public sealed override int GetStart(JsAst ast) { if (_node == null) { return(1); } return(_node.GetStart(ast.LocationResolver).Index); }
/// <summary> /// Gets the index in the file/buffer that this scope ends at. /// </summary> public sealed override int GetStop(JsAst ast) { if (_node == null) { return(int.MaxValue); } return(_node.GetEnd(ast.LocationResolver).Index); }
public OverviewWalker(ProjectEntry entry, AnalysisUnit topAnalysis, JsAst tree, bool isNested = false) { _entry = entry; _curUnit = topAnalysis; _isNested = isNested; _tree = tree; _scope = topAnalysis.Environment; }
internal AnalysisUnit(Statement ast, JsAst tree, EnvironmentRecord environment) { Ast = ast; Tree = tree; _env = environment; _id = Interlocked.Increment(ref _idCount); if (environment != null && !ForEval) { ProjectEntry.Analyzer.Log.NewUnit(this); } }
public override bool Walk(JsAst node) { #if FALSE ModuleReference existingRef; #endif //Debug.Assert(node == _unit.Ast); #if FALSE if (!ProjectState.Modules.TryGetValue(_unit.DeclaringModule.Name, out existingRef)) { // publish our module ref now so that we don't collect dependencies as we'll be fully processed ProjectState.Modules[_unit.DeclaringModule.Name] = new ModuleReference(_unit.DeclaringModule); } #endif return(base.Walk(node)); }
public override int GetStop(JsAst ast) { return(_endIndex); }
public override int GetBodyStart(JsAst ast) { return(_startIndex); }
public override bool Walk(JsAst jsAst) { return(true); }
public override int GetBodyStart(JsAst ast) { return(((FunctionObject)Node).Body.GetStartIndex(ast.LocationResolver)); }
public RangeVisitor(char typedChar, int position, JsAst tree) { _typedChar = typedChar; _position = position; _tree = tree; }
public ParseTreeWalker(JsAst tree) { _tree = tree; }
/// <summary> /// Gets the index in the file/buffer that this scope ends at. /// </summary> public abstract int GetStop(JsAst ast);
public override int GetStop(JsAst ast) { return(ast.IndexToLocation(_endIndex).Index); }
public virtual void PostWalk(JsAst jsAst) { }
/// <summary> /// Gets the index in the file/buffer that this scope starts at. This is the index which includes /// the definition it's self (e.g. def fob(...) or class fob(...)). /// </summary> public abstract int GetStart(JsAst ast);
/// <summary> /// Gets the index in the file/buffer that the scope actually starts on. This is the index where the colon /// is on for the start of the body if we're a function or class definition. /// </summary> public override int GetBodyStart(JsAst ast) { return(GetStart(ast)); }
public virtual bool Walk(JsAst jsAst) { return true; }
internal AnalysisUnit(JsAst ast, EnvironmentRecord environment) : this(ast, ast, environment) { }
public virtual bool Walk(JsAst jsAst) { return(true); }
public OutliningVisitor(JsAst ast, ITextSnapshot snapshot) { _ast = ast; _snapshot = snapshot; OutliningTagSpans = new List <ITagSpan <IOutliningRegionTag> >(); }
public override int GetStart(JsAst ast) { return(ast.IndexToLocation(_startIndex).Index); }
private static TagSpan GetFunctionSpan(JsAst ast, ITextSnapshot snapshot, FunctionObject functionObject) { IndexSpan indexSpan = functionObject.Body.GetSpan(ast.LocationResolver); return(GetTagSpan(snapshot, indexSpan.Start, indexSpan.End, functionObject.ParameterEnd)); }
internal EvalAnalysisUnit(Statement ast, JsAst tree, EnvironmentRecord scope) : base(ast, tree, scope) { }