本文整理汇总了C#中IronPython.Compiler.Ast.NameExpression类的典型用法代码示例。如果您正苦于以下问题:C# NameExpression类的具体用法?C# NameExpression怎么用?C# NameExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameExpression类属于IronPython.Compiler.Ast命名空间,在下文中一共展示了NameExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Walk
public override bool Walk(NameExpression node) {
// Called for the sublist parameters. The elements of the tuple become regular
// local variables, therefore don't make the parameters (DefineParameter), but
// regular locals (DefineName)
_binder.DefineName(node.Name);
node.Reference = _binder.Reference(node.Name);
return false;
}
示例2: Walk
public override bool Walk(NameExpression node)
{
if (currentAssignStatement != null) {
string nodeName = node.Name;
if (nodeName == variableName) {
foundVariableAssignment = true;
}
}
return base.Walk(node);
}
示例3: Walk
public override bool Walk(NameExpression node)
{
binder.DefineParameter(node.Name);
return false;
}
示例4: ParsePrimary
// primary: atom | attributeref | subscription | slicing | call
// atom: identifier | literal | enclosure
// enclosure:
// parenth_form |
// list_display |
// generator_expression |
// dict_display |
// string_conversion |
// yield_atom
private Expression ParsePrimary() {
Token t = PeekToken();
Expression ret;
switch (t.Kind) {
case TokenKind.LeftParenthesis: // parenth_form, generator_expression, yield_atom
NextToken();
return FinishTupleOrGenExp();
case TokenKind.LeftBracket: // list_display
NextToken();
return FinishListValue();
case TokenKind.LeftBrace: // dict_display
NextToken();
return FinishDictOrSetValue();
case TokenKind.BackQuote: // string_conversion
NextToken();
return FinishStringConversion();
case TokenKind.Name: // identifier
NextToken();
string name = (string)t.Value;
if (_sink != null) {
_sink.StartName(GetSourceSpan(), name);
}
ret = new NameExpression(FixName(name));
ret.SetLoc(_globalParent, GetStart(), GetEnd());
return ret;
case TokenKind.Constant: // literal
NextToken();
var start = GetStart();
object cv = t.Value;
string cvs = cv as string;
if (cvs != null) {
cv = FinishStringPlus(cvs);
} else {
Bytes bytes = cv as Bytes;
if (bytes != null) {
cv = FinishBytesPlus(bytes);
}
}
if (t is UnicodeStringToken) {
ret = ConstantExpression.MakeUnicode((string)cv);
} else {
ret = new ConstantExpression(cv);
}
ret.SetLoc(_globalParent, start, GetEnd());
return ret;
default:
ReportSyntaxError(_lookahead.Token, _lookahead.Span, ErrorCodes.SyntaxError, _allowIncomplete || _tokenizer.EndContinues);
// error node
ret = new ErrorExpression();
ret.SetLoc(_globalParent, _lookahead.Span.Start, _lookahead.Span.End);
return ret;
}
}
示例5: ParseDecorators
// decorators ::=
// decorator+
// decorator ::=
// "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE
private List<Expression> ParseDecorators() {
List<Expression> decorators = new List<Expression>();
while (MaybeEat(TokenKind.At)) {
var start = GetStart();
Expression decorator = new NameExpression(ReadName());
decorator.SetLoc(_globalParent, start, GetEnd());
while (MaybeEat(TokenKind.Dot)) {
string name = ReadNameMaybeNone();
decorator = new MemberExpression(decorator, name);
decorator.SetLoc(_globalParent, GetStart(), GetEnd());
}
decorator.SetLoc(_globalParent, start, GetEnd());
if (MaybeEat(TokenKind.LeftParenthesis)) {
if (_sink != null) {
_sink.StartParameters(GetSourceSpan());
}
Arg[] args = FinishArgumentList(null);
decorator = FinishCallExpr(decorator, args);
}
decorator.SetLoc(_globalParent, start, GetEnd());
EatNewLine();
decorators.Add(decorator);
}
return decorators;
}
示例6: Name
internal Name(NameExpression expr, expr_context ctx)
: this(expr.Name, ctx) {
}
示例7: Walk
public override bool Walk(NameExpression node)
{
node.Parent = _currentScope;
node.Reference = Reference(node.Name);
return true;
}
示例8: PostWalk
public override void PostWalk(NameExpression node)
{
}
示例9: Walk
public override bool Walk(NameExpression node)
{
if (null == node) {
throw new ArgumentNullException("node");
}
Define(node.Name);
return false;
}
示例10: PostWalk
public override void PostWalk(NameExpression node)
{
base.PostWalk(node);
Console.WriteLine("NODE NAME: "+node.Name);
}
示例11: SetPropertyValue
/// <summary>
/// Sets the property value that is referenced by this field expression.
/// </summary>
/// <remarks>
/// This method checks that the name expression matches a created instance before
/// converting the name expression as a string and setting the property value.
/// </remarks>
public bool SetPropertyValue(IComponentCreator componentCreator, NameExpression nameExpression)
{
object component = GetComponent(componentCreator);
PropertyDescriptor property = GetProperty(component, memberName);
if (property != null) {
string name = nameExpression.Name;
if (property.PropertyType != typeof(bool)) {
if ("self" == name) {
return SetPropertyValue(component, memberName, componentCreator.RootComponent);
} else {
object instance = componentCreator.GetInstance(name);
if (instance != null) {
return SetPropertyValue(component, memberName, instance);
}
}
}
return SetPropertyValue(component, memberName, name);
}
return false;
}
示例12: GetPropertyAccessors
private static bool GetPropertyAccessors(CallExpression rhsCall, ref NameExpression ne, ref string get, ref string set)
{
bool fCantEmit = false;
for (int i = 0; i < rhsCall.Args.Count; i++) {
// fget, fset, fdel, doc
if (rhsCall.Args[i].Name != SymbolTable.Empty) {
switch (rhsCall.Args[i].Name.GetString()) {
case "fget":
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
get = ne.Name.GetString();
break;
case "fset":
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
set = ne.Name.GetString();
break;
default:
fCantEmit = true;
break;
}
} else {
switch (i) {
case 0:
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
get = ne.Name.GetString();
break;
case 1:
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
set = ne.Name.GetString();
break;
default:
fCantEmit = true;
break;
}
}
}
return fCantEmit;
}
示例13: PostWalk
public virtual void PostWalk(NameExpression node)
{
}
示例14: Walk
// NameExpression
public virtual bool Walk(NameExpression node)
{
return true;
}
示例15: Walk
// NameExpression
public bool Walk(NameExpression node)
{
return Process(node);
}