本文整理汇总了C#中EcmaScript.NET.Node.getExistingIntProp方法的典型用法代码示例。如果您正苦于以下问题:C# Node.getExistingIntProp方法的具体用法?C# Node.getExistingIntProp怎么用?C# Node.getExistingIntProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EcmaScript.NET.Node
的用法示例。
在下文中一共展示了Node.getExistingIntProp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitStatement
void VisitStatement (Node node)
{
int type = node.Type;
Node child = node.FirstChild;
switch (type) {
case Token.FUNCTION: {
int fnIndex = node.getExistingIntProp (Node.FUNCTION_PROP);
int fnType = scriptOrFn.getFunctionNode (fnIndex).FunctionType;
// Only function expressions or function expression
// statements needs closure code creating new function
// object on stack as function statements are initialized
// at script/function start
// In addition function expression can not present here
// at statement level, they must only present as expressions.
if (fnType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT) {
addIndexOp (Icode_CLOSURE_STMT, fnIndex);
}
else {
if (fnType != FunctionNode.FUNCTION_STATEMENT) {
throw Context.CodeBug ();
}
}
}
break;
case Token.SCRIPT:
case Token.LABEL:
case Token.LOOP:
case Token.BLOCK:
case Token.EMPTY:
case Token.WITH:
updateLineNumber (node);
while (child != null) {
VisitStatement (child);
child = child.Next;
}
break;
case Token.ENTERWITH:
VisitExpression (child, 0);
addToken (Token.ENTERWITH);
stackChange (-1);
break;
case Token.LEAVEWITH:
addToken (Token.LEAVEWITH);
break;
case Token.LOCAL_BLOCK: {
int local = allocLocal ();
node.putIntProp (Node.LOCAL_PROP, local);
updateLineNumber (node);
while (child != null) {
VisitStatement (child);
child = child.Next;
}
addIndexOp (Icode_LOCAL_CLEAR, local);
releaseLocal (local);
}
break;
case Token.DEBUGGER:
updateLineNumber (node);
addIcode (Icode_DEBUGGER);
break;
case Token.SWITCH:
updateLineNumber (node); {
// See comments in IRFactory.createSwitch() for description
// of SWITCH node
Node switchNode = (Node.Jump)node;
VisitExpression (child, 0);
for (Node.Jump caseNode = (Node.Jump)child.Next; caseNode != null; caseNode = (Node.Jump)caseNode.Next) {
if (caseNode.Type != Token.CASE)
throw badTree (caseNode);
Node test = caseNode.FirstChild;
addIcode (Icode_DUP);
stackChange (1);
VisitExpression (test, 0);
addToken (Token.SHEQ);
stackChange (-1);
// If true, Icode_IFEQ_POP will jump and remove case
// value from stack
addGoto (caseNode.target, Icode_IFEQ_POP);
stackChange (-1);
}
addIcode (Icode_POP);
stackChange (-1);
}
break;
case Token.TARGET:
markTargetLabel (node);
//.........这里部分代码省略.........
示例2: VisitExpression
void VisitExpression (Node node, int contextFlags)
{
if (VisitExpressionOptimized (node, contextFlags))
return;
int type = node.Type;
Node child = node.FirstChild;
int savedStackDepth = itsStackDepth;
switch (type) {
case Token.FUNCTION: {
int fnIndex = node.getExistingIntProp (Node.FUNCTION_PROP);
FunctionNode fn = scriptOrFn.getFunctionNode (fnIndex);
// See comments in visitStatement for Token.FUNCTION case
switch (fn.FunctionType) {
case FunctionNode.FUNCTION_EXPRESSION:
addIndexOp (Icode_CLOSURE_EXPR, fnIndex);
break;
default:
throw Context.CodeBug ();
}
stackChange (1);
}
break;
case Token.LOCAL_LOAD: {
int localIndex = getLocalBlockRef (node);
addIndexOp (Token.LOCAL_LOAD, localIndex);
stackChange (1);
}
break;
case Token.COMMA: {
Node lastChild = node.LastChild;
while (child != lastChild) {
VisitExpression (child, 0);
addIcode (Icode_POP);
stackChange (-1);
child = child.Next;
}
// Preserve tail context flag if any
VisitExpression (child, contextFlags & ECF_TAIL);
}
break;
case Token.USE_STACK:
// Indicates that stack was modified externally,
// like placed catch object
stackChange (1);
break;
case Token.REF_CALL:
case Token.CALL:
case Token.NEW: {
if (type == Token.NEW) {
VisitExpression (child, 0);
}
else {
generateCallFunAndThis (child);
}
int argCount = 0;
while ((child = child.Next) != null) {
VisitExpression (child, 0);
++argCount;
}
int callType = node.getIntProp (Node.SPECIALCALL_PROP, Node.NON_SPECIALCALL);
if (callType != Node.NON_SPECIALCALL) {
// embed line number and source filename
addIndexOp (Icode_CALLSPECIAL, argCount);
addUint8 (callType);
addUint8 (type == Token.NEW ? 1 : 0);
addUint16 (itsLineNumber & 0xFFFF);
}
else {
if (type == Token.CALL) {
if ((contextFlags & ECF_TAIL) != 0) {
type = Icode_TAIL_CALL;
}
}
addIndexOp (type, argCount);
}
// adjust stack
if (type == Token.NEW) {
// new: f, args -> result
stackChange (-argCount);
}
else {
// call: f, thisObj, args -> result
// ref_call: f, thisObj, args -> ref
stackChange (-1 - argCount);
}
if (argCount > itsData.itsMaxCalleeArgs) {
itsData.itsMaxCalleeArgs = argCount;
//.........这里部分代码省略.........
示例3: VisitIncDec
void VisitIncDec (Node node, Node child)
{
int incrDecrMask = node.getExistingIntProp (Node.INCRDECR_PROP);
int childType = child.Type;
switch (childType) {
case Token.GETVAR: {
if (itsData.itsNeedsActivation)
Context.CodeBug ();
string name = child.String;
int i = scriptOrFn.getParamOrVarIndex (name);
addVarOp (Icode_VAR_INC_DEC, i);
addUint8 (incrDecrMask);
stackChange (1);
break;
}
case Token.NAME: {
string name = child.String;
addStringOp (Icode_NAME_INC_DEC, name);
addUint8 (incrDecrMask);
stackChange (1);
break;
}
case Token.GETPROP: {
Node obj = child.FirstChild;
VisitExpression (obj, 0);
string property = obj.Next.String;
addStringOp (Icode_PROP_INC_DEC, property);
addUint8 (incrDecrMask);
break;
}
case Token.GETELEM: {
Node obj = child.FirstChild;
VisitExpression (obj, 0);
Node index = obj.Next;
VisitExpression (index, 0);
addIcode (Icode_ELEM_INC_DEC);
addUint8 (incrDecrMask);
stackChange (-1);
break;
}
case Token.GET_REF: {
Node rf = child.FirstChild;
VisitExpression (rf, 0);
addIcode (Icode_REF_INC_DEC);
addUint8 (incrDecrMask);
break;
}
default: {
throw badTree (node);
}
}
}