本文整理汇总了C#中Microsoft.PythonTools.Parsing.Ast.NameExpression类的典型用法代码示例。如果您正苦于以下问题:C# NameExpression类的具体用法?C# NameExpression怎么用?C# NameExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameExpression类属于Microsoft.PythonTools.Parsing.Ast命名空间,在下文中一共展示了NameExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListInsert
private IAnalysisSet ListInsert(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (args.Length == 2) {
AppendItem(node, unit, args[1]);
}
return unit.ProjectState._noneInst;
}
示例2: Call
public override ISet<Namespace> Call(Node node, AnalysisUnit unit, ISet<Namespace>[] args, NameExpression[] keywordArgNames) {
_generator.Callers.AddDependency(unit);
_generator.AddReturn(node, unit, base.Call(node, unit, args, keywordArgNames));
return _generator.SelfSet;
}
示例3: Call
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (_original == null) {
return base.Call(node, unit, args, keywordArgNames);
}
return _original.Call(node, unit, args, keywordArgNames);
}
示例4: FromImportStatement
public FromImportStatement(ModuleName root, NameExpression/*!*/[] names, NameExpression[] asNames, bool fromFuture, bool forceAbsolute) {
_root = root;
_names = names;
_asNames = asNames;
_fromFuture = fromFuture;
_forceAbsolute = forceAbsolute;
}
示例5: Call
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
var res = (DictionaryInfo)unit.Scope.GetOrMakeNodeValue(
node,
NodeValueKind.Dictionary,
(node_) => new DictionaryInfo(unit.ProjectEntry, node)
);
if (keywordArgNames.Length > 0) {
for (int i = 0; i < keywordArgNames.Length; i++) {
var curName = keywordArgNames[i].Name;
var curArg = args[args.Length - keywordArgNames.Length + i];
if (curName == "**") {
foreach (var value in curArg) {
CopyFrom(args, res);
}
} else if (curName != "*") {
res.AddTypes(
node,
unit,
ProjectState.GetConstant(curName),
curArg
);
}
}
} else if (args.Length == 1) {
foreach (var value in args[0]) {
CopyFrom(args, res);
}
}
return res;
}
示例6: Call
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (args.Length == 1) {
var res = unit.Scope.GetOrMakeNodeValue(
node,
(node_) => MakeFromIndexes(node_, unit.ProjectEntry)
) as SequenceInfo;
List<IAnalysisSet> seqTypes = new List<IAnalysisSet>();
foreach (var type in args[0]) {
SequenceInfo seqInfo = type as SequenceInfo;
if (seqInfo != null) {
for (int i = 0; i < seqInfo.IndexTypes.Length; i++) {
if (seqTypes.Count == i) {
seqTypes.Add(seqInfo.IndexTypes[i].Types);
} else {
seqTypes[i] = seqTypes[i].Union(seqInfo.IndexTypes[i].Types);
}
}
} else {
var defaultIndexType = type.GetIndex(node, unit, ProjectState.GetConstant(0));
if (seqTypes.Count == 0) {
seqTypes.Add(defaultIndexType);
} else {
seqTypes[0] = seqTypes[0].Union(defaultIndexType);
}
}
}
res.AddTypes(unit, seqTypes.ToArray());
return res;
}
return base.Call(node, unit, args, keywordArgNames);
}
示例7: Call
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
var res = AnalysisSet.Empty;
foreach (var member in _members) {
res = res.Union(member.Call(node, unit, args, keywordArgNames));
}
return res;
}
示例8: SequenceIter
private IAnalysisSet SequenceIter(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (_iterator == null) {
var types = new [] { new VariableDef() };
types[0].AddTypes(unit, _indexTypes, false);
_iterator = new IteratorInfo(types, IteratorInfo.GetIteratorTypeFromType(ClassInfo, unit), node);
}
return _iterator ?? AnalysisSet.Empty;
}
示例9: AddParameterReferences
internal void AddParameterReferences(AnalysisUnit caller, NameExpression[] names) {
foreach (var name in names) {
VariableDef param;
if (name != null && TryGetVariable(name.Name, out param)) {
param.AddReference(name, caller);
}
}
}
示例10: ListExtend
private IAnalysisSet ListExtend(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (args.Length == 1) {
foreach (var type in args[0]) {
AppendItem(node, unit, type.GetEnumeratorTypes(node, unit));
}
}
return unit.ProjectState._noneInst;
}
示例11: IterableIter
private IAnalysisSet IterableIter(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (args.Length == 0) {
return unit.Scope.GetOrMakeNodeValue(
node,
NodeValueKind.Iterator,
n => MakeIteratorInfo(n, unit)
);
}
return AnalysisSet.Empty;
}
示例12: ObjectSetAttr
private IAnalysisSet ObjectSetAttr(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
if (args.Length >= 3) {
foreach (var ii in args[0].OfType<InstanceInfo>()) {
foreach (var key in args[1].GetConstantValueAsString()) {
ii.SetMember(node, unit, key, args[2]);
}
}
}
return AnalysisSet.Empty;
}
示例13: Call
public override INamespaceSet Call(Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames) {
var realArgs = args;
if (_inst != null) {
realArgs = Utils.Concat(_inst.SelfSet, args);
}
if (node is CallExpression) {
return _call((CallExpression)node, unit, realArgs, keywordArgNames) ?? NamespaceSet.Empty;
}
return NamespaceSet.Empty;
}
示例14: 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 IAnalysisSet Call(this IAnalysisSet self, Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
var res = AnalysisSet.Empty;
foreach (var ns in self) {
var call = ns.Call(node, unit, args, keywordArgNames);
Debug.Assert(call != null);
res = res.Union(call);
}
return res;
}
示例15: Call
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
var newArgs = _args.Take(_args.Length - _keywordArgNames.Length)
.Concat(args.Take(args.Length - keywordArgNames.Length))
.Concat(_args.Skip(_args.Length - _keywordArgNames.Length))
.Concat(args.Skip(args.Length - keywordArgNames.Length))
.ToArray();
var newKwArgs = _keywordArgNames.Concat(keywordArgNames).ToArray();
return _function.Call(node, unit, newArgs, newKwArgs);
}