本文整理汇总了C#中IronPython.Compiler.Ast.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于IronPython.Compiler.Ast命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AnalysisUnit
private AnalysisUnit(Node ast, InterpreterScope[] scopes, AnalysisUnit parent, bool forEval)
{
_ast = ast;
_scopes = scopes;
_parent = parent;
_forEval = forEval;
}
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:AnalysisUnit.cs
示例2: Call
public override ISet<Namespace> Call(Node node, AnalysisUnit unit, ISet<Namespace>[] args, string[] keywordArgNames)
{
if (args.Length == 1) {
_list.AppendItem(args[0]);
}
return ProjectState._noneInst.SelfSet;
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:ListAppendBoundBuiltinMethodInfo.cs
示例3: Call
public override ISet<Namespace> Call(Node node, AnalysisUnit unit, ISet<Namespace>[] args, string[] keywordArgNames)
{
if (args.Length == 1) {
_generator.AddSend(node, unit, args[0]);
}
return _generator.Yields;
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:GeneratorSendBoundBuiltinMethodInfo.cs
示例4: GetMember
public override ISet<Namespace> GetMember(Node node, AnalysisUnit unit, string name)
{
var res = base.GetMember(node, unit, name);
if (res.Count > 0) {
_references.AddReference(node, unit, name);
}
return res;
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:ReflectedNamespace.cs
示例5: Call
public override ISet<Namespace> Call(Node node, AnalysisUnit unit, ISet<Namespace>[] args, string[] keywordArgNames)
{
if (args.Length == 1) {
foreach (var type in args[0]) {
_list.AppendItem(type.GetEnumeratorTypes(node, unit));
}
}
return ProjectState._noneInst.SelfSet;
}
开发者ID:TerabyteX,项目名称:main,代码行数:10,代码来源:ListExtendBoundBuiltinFunction.cs
示例6: CreateVariable
public VariableDef CreateVariable(Node node, AnalysisUnit unit, string name, bool addRef = true)
{
var res = GetVariable(node, unit, name, addRef);
if (res == null) {
_variables[name] = res = new VariableDef();
if (addRef) {
res.AddReference(node, unit);
}
}
return res;
}
开发者ID:TerabyteX,项目名称:main,代码行数:11,代码来源:InterpreterScope.cs
示例7: SetUpFixture
public void SetUpFixture()
{
componentCreator = new MockComponentCreator();
AssignmentStatement assignment = PythonParserHelper.GetAssignmentStatement(GetPythonCode());
rhsAssignmentNode = assignment.Right;
mockDesignerLoaderHost = new MockDesignerLoaderHost();
typeResolutionService = mockDesignerLoaderHost.TypeResolutionService;
PythonCodeDeserializer deserializer = new PythonCodeDeserializer(componentCreator);
deserializedObject = deserializer.Deserialize(rhsAssignmentNode);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:DeserializeAssignmentTestFixtureBase.cs
示例8: GetIndex
public override ISet<Namespace> GetIndex(Node node, AnalysisUnit unit, ISet<Namespace> index)
{
// TODO: Return correct index value if we have a constant
/*int? constIndex = SequenceInfo.GetConstantIndex(index);
if (constIndex != null && constIndex.Value < _indexTypes.Count) {
// TODO: Warn if outside known index and no appends?
return _indexTypes[constIndex.Value];
}*/
return ProjectState._intType.SelfSet;
}
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:RangeInfo.cs
示例9: Call
/// <summary>
/// Performs a call operation propagating the argument types into any user defined functions
/// or classes and returns the set of types which result from the call.
/// </summary>
public static ISet<Namespace> Call(this ISet<Namespace> self, Node node, AnalysisUnit unit, ISet<Namespace>[] args, string[] keywordArgNames)
{
ISet<Namespace> res = EmptySet<Namespace>.Instance;
bool madeSet = false;
foreach (var ns in self) {
var call = ns.Call(node, unit, args, keywordArgNames);
Debug.Assert(call != null);
res = res.Union(call, ref madeSet);
}
return res;
}
开发者ID:TerabyteX,项目名称:main,代码行数:17,代码来源:NamespaceSetExtensions.cs
示例10: BinaryOperation
public override ISet<Namespace> BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, ISet<Namespace> rhs)
{
switch (operation) {
case PythonOperator.GreaterThan:
case PythonOperator.LessThan:
case PythonOperator.LessThanOrEqual:
case PythonOperator.GreaterThanOrEqual:
case PythonOperator.Equal:
case PythonOperator.NotEqual:
case PythonOperator.Is:
case PythonOperator.IsNot:
return ProjectState._boolType.Instance;
}
return base.BinaryOperation(node, unit, operation, rhs);
}
开发者ID:TerabyteX,项目名称:main,代码行数:15,代码来源:NumericInstanceInfo.cs
示例11: BinaryOperation
public static ISet<Namespace> BinaryOperation(this ISet<Namespace> self, Node node, AnalysisUnit unit, PythonOperator operation, ISet<Namespace> rhs)
{
ISet<Namespace> res = null;
bool madeSet = false;
foreach (var ns in self) {
ISet<Namespace> got = ns.BinaryOperation(node, unit, operation, rhs);
if (res == null) {
res = got;
continue;
} else if (!madeSet) {
res = new HashSet<Namespace>(res);
madeSet = true;
}
res.UnionWith(got);
}
return res ?? EmptySet<Namespace>.Instance;
}
开发者ID:TerabyteX,项目名称:main,代码行数:18,代码来源:NamespaceSetExtensions.cs
示例12: GetMember
public override ISet<Namespace> GetMember(Node node, AnalysisUnit unit, string name)
{
switch (name) {
case "append":
EnsureAppend();
return _appendMethod.SelfSet;
case "pop":
EnsurePop();
return _popMethod.SelfSet;
case "insert":
EnsureInsert();
return _insertMethod.SelfSet;
case "extend":
EnsureExtend();
return _extendMethod.SelfSet;
}
return base.GetMember(node, unit, name);
}
开发者ID:TerabyteX,项目名称:main,代码行数:19,代码来源:ListInfo.cs
示例13: Deserialize
/// <summary>
/// Creates or gets the object specified in the python AST.
/// </summary>
/// <returns>
/// Null if the node cannot be deserialized.
/// </returns>
public object Deserialize(Node node)
{
if (node == null) {
throw new ArgumentNullException("node");
}
if (node is CallExpression) {
return Deserialize((CallExpression)node);
} else if (node is BinaryExpression) {
return Deserialize((BinaryExpression)node);
} else if (node is MemberExpression) {
return Deserialize((MemberExpression)node);
} else if (node is UnaryExpression) {
return Deserialize((UnaryExpression)node);
} else if (node is ConstantExpression) {
return Deserialize((ConstantExpression)node);
} else if (node is NameExpression) {
return Deserialize((NameExpression)node);
}
return null;
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:27,代码来源:PythonCodeDeserializer.cs
示例14: Locate
public bool Locate(int line, int column, out Node node, out Scope scope)
{
Locator locator = new Locator(line, column);
global.Walk(locator);
node = locator.Candidate;
scope = locator.Scope != null ? scopes[locator.Scope] : null;
#if DEBUG
if (node != null)
{
Debug.Print("Located {0} at {1}:{2}-{3}:{4}",
node,
node.Start.Line, node.Start.Column,
node.End.Line, node.End.Column
);
}
#endif
return node != null;
}
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:21,代码来源:Modules.cs
示例15: CommonWalk
private void CommonWalk(Node node)
{
tree.Push(node);
}
开发者ID:valdisz,项目名称:PyToJs,代码行数:4,代码来源:JavascriptGenerator.cs
示例16: CommonPostWalk
private void CommonPostWalk(Node node, bool skip = false)
{
if (tree.Count > 0)
{
tree.Pop();
}
if (skip)
{
return;
}
Node parent = tree.Count > 0
? tree.Peek()
: null;
if (parent is SuiteStatement && content.Count > 0)
{
var s = Content();
Content("{0}{1};", Indent(), s);
}
}
开发者ID:valdisz,项目名称:PyToJs,代码行数:22,代码来源:JavascriptGenerator.cs
示例17: CheckForIllegalWords
private void CheckForIllegalWords(Node node, string word)
{
if (Array.IndexOf<string>(jsReservedWords, word) >= 0)
{
sink.Add(src, String.Format("\"{0}\" is reserved word in JavaScript and cannot be used.", word), node.Span, RESERVED_WORD, Severity.Error);
}
}
开发者ID:valdisz,项目名称:PyToJs,代码行数:7,代码来源:JavascriptGenerator.cs
示例18: CompleteParameterName
private void CompleteParameterName(Node node, SymbolId name, Dictionary<SymbolId, object> names) {
SourceSpan span = GetSpan();
_sink.StartName(span, SymbolTable.IdToString(name));
CheckUniqueParameter(names, name);
node.SetLoc(span);
}
开发者ID:tnachen,项目名称:ironruby,代码行数:6,代码来源:Parser.cs
示例19: SaveCandidate
private void SaveCandidate(Node node)
{
if (candidateNode == null || Better(node, candidateNode))
{
Debug.Print("Candidate: {0} at {1}:{2}-{3}:{4} ({5}:{6})",
node, node.Start.Line, node.Start.Column, node.End.Line, node.End.Column,
location.Line, location.Column);
candidateNode = node;
candidateScope = current;
candidateContext = context != null && context.Count > 0 ? context.Peek() : null;
}
}
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:13,代码来源:Locator.cs
示例20: Convert
internal static AST Convert(Node node) {
AST ast;
if (node is TryStatementHandler)
ast = new ExceptHandler((TryStatementHandler)node);
else
throw new ArgumentTypeException("Unexpected node type: " + node.GetType());
ast.GetSourceLocation(node);
return ast;
}
开发者ID:rchandrashekara,项目名称:main,代码行数:11,代码来源:_ast.cs
注:本文中的IronPython.Compiler.Ast.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论