本文整理汇总了C#中JsAstNode.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# JsAstNode.Accept方法的具体用法?C# JsAstNode.Accept怎么用?C# JsAstNode.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsAstNode
的用法示例。
在下文中一共展示了JsAstNode.Accept方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public static void Apply(JsAstNode node)
{
if (node != null)
{
node.Accept(s_instance);
}
}
示例2: Apply
public static bool Apply(TextWriter writer, JsAstNode node)
{
if (node != null)
{
var visitor = new JsonOutputVisitor(writer);
node.Accept(visitor);
return visitor.IsValid;
}
return false;
}
示例3: Match
public bool Match(JsAstNode node, string identifiers)
{
// set the match to false
m_isMatch = false;
// identifiers cannot be null or blank and must match: IDENT(.IDENT)*
// since for JS there has to be at least a global object, the dot must be AFTER the first character.
if (node != null && !string.IsNullOrEmpty(identifiers))
{
// get all the parts
var parts = identifiers.Split('.');
// each part must be a valid JavaScript identifier. Assume everything is valid
// unless at least one is invalid -- then forget it
var isValid = true;
foreach (var part in parts)
{
if (!JsScanner.IsValidIdentifier(part))
{
isValid = false;
break;
}
}
// must be valid to continue
if (isValid)
{
// save the parts and start the index on the last one, since we'll be walking backwards
m_parts = parts;
m_index = parts.Length - 1;
node.Accept(this);
}
}
return m_isMatch;
}
示例4: Apply
public static void Apply(JsAstNode node, JsActivationObject scope, JsSettings settings)
{
if (node != null && scope != null)
{
// create the visitor and run it. This will create all the child
// scopes and populate all the scopes with the var-decl, lex-decl,
// and lookup references within them.
var visitor = new JsResolutionVisitor(scope, settings);
node.Accept(visitor);
// now that all the scopes are created and they all know what decls
// they contains, create all the fields
CreateFields(scope);
// now that all the fields have been created in all the scopes,
// let's go through and resolve all the references
ResolveLookups(scope, settings);
// now that everything is declared and resolved as per the language specs,
// we need to go back and add ghosted fields for older versions of IE that
// incorrectly implement catch-variables and named function expressions.
AddGhostedFields(scope);
}
}
示例5: NeedsParens
public static bool NeedsParens(JsAstNode expression, bool outerHasNoArguments)
{
var visitor = new JsNewParensVisitor(outerHasNoArguments);
expression.Accept(visitor);
return visitor.m_needsParens;
}
示例6: Apply
public static void Apply(TextWriter writer, JsAstNode node, JsSettings settings)
{
if (node != null)
{
var outputVisitor = new JsOutputVisitor(writer, settings);
node.Accept(outputVisitor);
// if there is a symbol map that we are tracking, tell it that we have ended an output run
// and pass it offsets to the last line and column positions.
settings.IfNotNull(s => s.SymbolsMap.IfNotNull(m => m.EndOutputRun(outputVisitor.m_lineCount, outputVisitor.m_lineLength)));
}
}
示例7: AcceptNodeWithParens
private void AcceptNodeWithParens(JsAstNode node, bool needsParens)
{
// if we need parentheses, add the opening
if (needsParens)
{
OutputPossibleLineBreak('(');
// because we output an open paren, reset the start flag
m_startOfStatement = false;
// and because we are outputting a paren, we are no longer in a no-in scenario
m_noIn = false;
}
// now output the node
node.Accept(this);
// if we need parentheses, add the closing and restore whatever noin state we had
if (needsParens)
{
Output(')');
}
// make SURE the start flag is reset
m_startOfStatement = false;
}
示例8: Apply
public static void Apply(JsAstNode node, JsParser parser)
{
var visitor = new JsFinalPassVisitor(parser);
node.Accept(visitor);
}