Skip to content

Commit ec57f03

Browse files
committed
lazy parse table
1 parent ff268a7 commit ec57f03

File tree

1 file changed

+10
-6
lines changed
  • src/main/java/com/tang/intellij/lua/debugger/remote/value

1 file changed

+10
-6
lines changed

src/main/java/com/tang/intellij/lua/debugger/remote/value/LuaRTable.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
public class LuaRTable extends LuaRValue {
3232
private XValueChildrenList list;
3333
private String desc;
34+
private LuaValue data;
3435

3536
LuaRTable(@NotNull String name) {
3637
super(name);
@@ -39,12 +40,7 @@ public class LuaRTable extends LuaRValue {
3940
@Override
4041
protected void parse(LuaValue data, String desc) {
4142
this.desc = "table";
42-
list = new XValueChildrenList();
43-
LuaTable table = data.checktable();
44-
for (LuaValue key : table.keys()) {
45-
LuaRValue value = LuaRValue.create(key.toString(), table.get(key), null);
46-
list.add(value);
47-
}
43+
this.data = data;
4844
}
4945

5046
@Override
@@ -54,6 +50,14 @@ public void computePresentation(@NotNull XValueNode xValueNode, @NotNull XValueP
5450

5551
@Override
5652
public void computeChildren(@NotNull XCompositeNode node) {
53+
if (list == null) {
54+
list = new XValueChildrenList();
55+
LuaTable table = data.checktable();
56+
for (LuaValue key : table.keys()) {
57+
LuaRValue value = LuaRValue.create(key.toString(), table.get(key), null);
58+
list.add(value);
59+
}
60+
}
5761
node.addChildren(list, true);
5862
}
5963
}

0 commit comments

Comments
 (0)