public static String encodeScope(StaticScope scope) { StringBuilder namesBuilder = new StringBuilder(scope.getType().name()); namesBuilder.append(','); boolean first = true; for (String name : scope.getVariables()) { if (!first) namesBuilder.append(';'); first = false; namesBuilder.append(name); } namesBuilder .append(',') .append(scope.getRequiredArgs()) .append(',') .append(scope.getOptionalArgs()) .append(',') .append(scope.getRestArg()); return namesBuilder.toString(); }
@SuppressWarnings("deprecation") static StaticScope decodeScope(ThreadContext context, StaticScope parent, String scopeString) { String[][] decodedScope = decodeScopeDescriptor(scopeString); String scopeTypeName = decodedScope[0][0]; String[] names = decodedScope[1]; StaticScope scope = null; switch (StaticScope.Type.valueOf(scopeTypeName)) { case BLOCK: scope = context.runtime.getStaticScopeFactory().newBlockScope(parent, names); break; case EVAL: scope = context.runtime.getStaticScopeFactory().newEvalScope(parent, names); break; case LOCAL: scope = context.runtime.getStaticScopeFactory().newLocalScope(parent, names); break; } setAritiesFromDecodedScope(scope, decodedScope[0][2]); scope.setScopeType(IRScopeType.valueOf(decodedScope[0][3])); return scope; }
public static StaticScope decodeScope(ThreadContext context, StaticScope parent, String scopeString) { String[][] decodedScope = decodeScopeDescriptor(scopeString); StaticScope scope = null; switch (StaticScope.Type.valueOf(decodedScope[0][0])) { case BLOCK: scope = context.runtime.getStaticScopeFactory().newBlockScope(parent, decodedScope[1]); break; case EVAL: scope = context.runtime.getStaticScopeFactory().newEvalScope(parent, decodedScope[1]); break; case LOCAL: scope = context.runtime.getStaticScopeFactory().newLocalScope(parent, decodedScope[1]); break; } setAritiesFromDecodedScope(scope, decodedScope[0]); return scope; }
@SuppressWarnings("deprecation") static StaticScope decodeScope(ThreadContext context, StaticScope parent, String scopeString) { String[][] decodedScope = decodeScopeDescriptor(scopeString); String scopeTypeName = decodedScope[0][0]; String[] names = decodedScope[1]; StaticScope scope = null; switch (StaticScope.Type.valueOf(scopeTypeName)) { case BLOCK: scope = context.runtime.getStaticScopeFactory().newBlockScope(parent, names); break; case EVAL: scope = context.runtime.getStaticScopeFactory().newEvalScope(parent, names); break; case LOCAL: scope = context.runtime.getStaticScopeFactory().newLocalScope(parent, names); break; } setAritiesFromDecodedScope(scope, decodedScope[0][2]); scope.setScopeType(IRScopeType.valueOf(decodedScope[0][3])); return scope; }
public static StaticScope decodeScope(ThreadContext context, StaticScope parent, String scopeString) { String[][] decodedScope = decodeScopeDescriptor(scopeString); StaticScope scope = null; switch (StaticScope.Type.valueOf(decodedScope[0][0])) { case BLOCK: scope = context.runtime.getStaticScopeFactory().newBlockScope(parent, decodedScope[1]); break; case EVAL: scope = context.runtime.getStaticScopeFactory().newEvalScope(parent, decodedScope[1]); break; case LOCAL: scope = context.runtime.getStaticScopeFactory().newLocalScope(parent, decodedScope[1]); break; } setAritiesFromDecodedScope(scope, decodedScope[0]); return scope; }
public static String encodeScope(StaticScope scope) { StringBuilder namesBuilder = new StringBuilder(scope.getType().name()); namesBuilder.append(','); boolean first = true; for (String name : scope.getVariables()) { if (!first) namesBuilder.append(';'); first = false; namesBuilder.append(name); } namesBuilder .append(',') .append(scope.getRequiredArgs()) .append(',') .append(scope.getOptionalArgs()) .append(',') .append(scope.getRestArg()); return namesBuilder.toString(); }
@SuppressWarnings("deprecation") static String encodeScope(StaticScope scope) { StringBuilder namesBuilder = new StringBuilder(scope.getType().name()); // 0 namesBuilder.append(','); // 1 boolean first = true; for (String name : scope.getVariables()) { if (!first) namesBuilder.append(';'); first = false; namesBuilder.append(name); } namesBuilder.append(',').append(scope.getSignature().encode()); // 2 namesBuilder.append(',').append(scope.getScopeType()); // 3 return namesBuilder.toString(); }
@Override public StaticScope.Type decodeStaticScopeType() { return StaticScope.Type.fromOrdinal(decodeInt()); }
@SuppressWarnings("deprecation") static String encodeScope(StaticScope scope) { StringBuilder namesBuilder = new StringBuilder(scope.getType().name()); // 0 namesBuilder.append(','); // 1 boolean first = true; for (String name : scope.getVariables()) { if (!first) namesBuilder.append(';'); first = false; namesBuilder.append(name); } namesBuilder.append(',').append(scope.getSignature().encode()); // 2 namesBuilder.append(',').append(scope.getScopeType()); // 3 return namesBuilder.toString(); }
@Override public void encode(StaticScope.Type value) { encode((byte) value.ordinal()); }
@Override public StaticScope.Type decodeStaticScopeType() { return StaticScope.Type.fromOrdinal(decodeInt()); }
@Override public void encode(StaticScope.Type value) { encode((byte) value.ordinal()); }