public void removeProp(int propType) { PropListItem x = propListHead; if (x != null) { PropListItem prev = null; while (x.Type != propType) { prev = x; x = x.next; if (x == null) { return; } } if (prev == null) { propListHead = x.next; } else { prev.next = x.next; } } }
public int getExistingIntProp(int propType) { PropListItem item = lookupProperty(propType); if (item == null) { Context.CodeBug(); } return(item.intValue); }
public int getIntProp(int propType, int defaultValue) { PropListItem item = lookupProperty(propType); if (item == null) { return(defaultValue); } return(item.intValue); }
public object getProp(int propType) { PropListItem item = lookupProperty(propType); if (item == null) { return(null); } return(item.objectValue); }
private PropListItem lookupProperty(int propType) { PropListItem x = propListHead; while (x != null && propType != x.Type) { x = x.next; } return(x); }
public void putProp(int propType, object prop) { if (prop == null) { removeProp(propType); } else { PropListItem item = ensureProperty(propType); item.objectValue = prop; } }
private PropListItem ensureProperty(int propType) { PropListItem item = lookupProperty(propType); if (item == null) { item = new PropListItem(); item.Type = propType; item.next = propListHead; propListHead = item; } return(item); }
private PropListItem ensureProperty(int propType) { PropListItem item = lookupProperty (propType); if (item == null) { item = new PropListItem (); item.Type = propType; item.next = propListHead; propListHead = item; } return item; }
public void removeProp(int propType) { PropListItem x = propListHead; if (x != null) { PropListItem prev = null; while (x.Type != propType) { prev = x; x = x.next; if (x == null) { return; } } if (prev == null) { propListHead = x.next; } else { prev.next = x.next; } } }
private void toString(ObjToIntMap printIds, System.Text.StringBuilder sb) { if (Token.printTrees) { sb.Append(Token.name(this.Type)); if (this is StringNode) { sb.Append(' '); sb.Append(String); } else if (this is ScriptOrFnNode) { ScriptOrFnNode sof = (ScriptOrFnNode)this; if (this is FunctionNode) { FunctionNode fn = (FunctionNode)this; sb.Append(' '); sb.Append(fn.FunctionName); } sb.Append(" [source name: "); sb.Append(sof.SourceName); sb.Append("] [encoded source length: "); sb.Append(sof.EncodedSourceEnd - sof.EncodedSourceStart); sb.Append("] [base line: "); sb.Append(sof.BaseLineno); sb.Append("] [end line: "); sb.Append(sof.EndLineno); sb.Append(']'); } else if (this is Jump) { Jump jump = (Jump)this; if (this.Type == Token.BREAK || this.Type == Token.CONTINUE) { sb.Append(" [label: "); appendPrintId(jump.JumpStatement, printIds, sb); sb.Append(']'); } else if (this.Type == Token.TRY) { Node catchNode = jump.target; Node finallyTarget = jump.Finally; if (catchNode != null) { sb.Append(" [catch: "); appendPrintId(catchNode, printIds, sb); sb.Append(']'); } if (finallyTarget != null) { sb.Append(" [finally: "); appendPrintId(finallyTarget, printIds, sb); sb.Append(']'); } } else if (this.Type == Token.LABEL || this.Type == Token.LOOP || this.Type == Token.SWITCH) { sb.Append(" [break: "); appendPrintId(jump.target, printIds, sb); sb.Append(']'); if (this.Type == Token.LOOP) { sb.Append(" [continue: "); appendPrintId(jump.Continue, printIds, sb); sb.Append(']'); } } else { sb.Append(" [target: "); appendPrintId(jump.target, printIds, sb); sb.Append(']'); } } else if (this.Type == Token.NUMBER) { sb.Append(' '); sb.Append(Double); } else if (this.Type == Token.TARGET) { sb.Append(' '); appendPrintId(this, printIds, sb); } if (lineno != -1) { sb.Append(' '); sb.Append(lineno); } for (PropListItem x = propListHead; x != null; x = x.next) { int Type = x.Type; sb.Append(" ["); sb.Append(propToString(Type)); sb.Append(": "); string value; switch (Type) { case TARGETBLOCK_PROP: // can't add this as it recurses value = "target block property"; break; case LOCAL_BLOCK_PROP: // can't add this as it is dull value = "last local block"; break; case ISNUMBER_PROP: switch (x.intValue) { case BOTH: value = "both"; break; case RIGHT: value = "right"; break; case LEFT: value = "left"; break; default: throw Context.CodeBug(); } break; case SPECIALCALL_PROP: switch (x.intValue) { case SPECIALCALL_EVAL: value = "eval"; break; case SPECIALCALL_WITH: value = "with"; break; default: // NON_SPECIALCALL should not be stored throw Context.CodeBug(); } break; default: object obj = x.objectValue; if (obj != null) { value = obj.ToString(); } else { value = Convert.ToString(x.intValue); } break; } sb.Append(value); sb.Append(']'); } } }
public void putIntProp(int propType, int prop) { PropListItem item = ensureProperty(propType); item.intValue = prop; }