本文整理汇总了C#中Method.setLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Method.setLevel方法的具体用法?C# Method.setLevel怎么用?C# Method.setLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method.setLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buildMethod
private bool buildMethod(ClassItemAccessLevel level, bool isStatic, Token token, EnegyData data)
{
//control if there are is name after function :)
if (token.getCache().type() != TokenType.Variabel)
{
data.setError(new ScriptError("A method should have a name", token.getCache().posision()), db);
return false;
}
string type = null;
//okay the name can be a type so wee control it here :)
if (Types.IsType(token.getCache().ToString(), db))
{
type = token.getCache().ToString();
if(token.next().type() != TokenType.Variabel)
{
data.setError(new ScriptError("A method should have a name", token.getCache().posision()), db);
return false;
}
}
Method method = new Method(token.getCache().ToString());
token.next();
if (isStatic)
method.SetStatic();
method.SetAgumentStack(AgumentParser.parseAguments(token, db, data));
method.SetBody(new CallScriptMethod(method.GetAgumentStack(), BodyParser.parse(token, data, db)).call);
method.SetVariabel();//in this way the script can use agument as name :)
method.setLevel(level);
builder.SetMethod(method, data, db, token.getCache().posision());
token.next();
return true;
}
示例2: createStringClass
private static void createStringClass(EnegyData data, VariabelDatabase db, Posision pos)
{
Class s = new Class("string");
Method format = new Method("format");
format.SetStatic();
format.GetAgumentStack().push("string", "query");
format.GetAgumentStack().push("array", "parameters");
format.SetBody(Format_caller);
s.SetMethod(format, data, db, pos);
//constructor :)
Method constructor = new Method(null);
constructor.GetAgumentStack().push("string", "s", new NullVariabel());
constructor.SetBody(Constructor_caller);
s.SetConstructor(constructor, data, db, pos);
Method length = new Method("length");
length.SetBody(Length_caller);
s.SetMethod(length, data, db, pos);
Method substr = new Method("substr");
substr.GetAgumentStack().push("int", "min");
substr.GetAgumentStack().push("int", "max", new NullVariabel());
substr.SetBody(Substr_caller);
s.SetMethod(substr, data, db, pos);
Method indexOf = new Method("indexOf");
indexOf.GetAgumentStack().push("string", "serche");
indexOf.SetBody(IndexOf_caller);
s.SetMethod(indexOf, data, db, pos);
Method toChars = new Method("toChars");
toChars.SetBody(ToChars_caller);
s.SetMethod(toChars, data, db, pos);
Method split = new Method("split");
split.GetAgumentStack().push("string", "string");
split.SetBody(Split_caller);
s.SetMethod(split, data, db, pos);
Method toLower = new Method("toLower");
toLower.SetBody(ToLower_caller);
s.SetMethod(toLower, data, db, pos);
Method toUpper = new Method("toUpper");
toUpper.SetBody(ToUpper_caller);
s.SetMethod(toUpper, data, db, pos);
Method toString = new Method("toString");
toString.SetBody(ToString_caller);
s.SetMethod(toString, data, db, pos);
Method set = new Method("set");
set.GetAgumentStack().push("string", "context");
set.setLevel(ClassItemAccessLevel.Protected);
set.SetBody(Set_caller);
s.SetMethod(set, data, db, pos);
db.pushClass(s, data);
}