Giter VIP home page Giter VIP logo

Comments (4)

eglassman avatar eglassman commented on July 25, 2024

@gustavoasoares It looks like the first child's id is 6, not 1. WTF?

from refazer.

eglassman avatar eglassman commented on July 25, 2024

In this test case:

foreach (var string_int_tuple in examples_strings_and_ints)
            {
                var rootNode = NodeWrapper.Wrap(ASTHelper.ParseContent(string_int_tuple.Item1));
                rootNode.PrintTree();
                var extractedNode = rootNode.Find(string_int_tuple.Item2);
                examples.Add(Tuple.Create(rootNode, extractedNode));
            }

Here are the results of rootNode.PrintTree():

First example's AST, with NodeIDs:

1
SuiteStatement(){ AssignmentStatement(){ NameExpression(i) literal(0) } }
2
AssignmentStatement(){ NameExpression(i) literal(0) }
3
NameExpression(i)
4
literal(0)

Second example's AST, with NodeIDs:

6
SuiteStatement(){ AssignmentStatement(){ NameExpression(j) literal(1) } }
7
AssignmentStatement(){ NameExpression(j) literal(1) }
8
NameExpression(j)
9
literal(1)

@gustavoasoares why does your NodeWrapper not restart it's counting? How do I ask it to do so?

from refazer.

eglassman avatar eglassman commented on July 25, 2024

So, it seems that this is the problem: When I repeatedly wrap each example AST, the counter IdCount is not reset. Is there any problem with resetting it?

public abstract class PythonNode
    {
        public static int IdCount = 0;

        protected InsertStrategy InsertStrategy { set; get; }

        public int Id { get; set; }

        public dynamic Value { get; set; }

        public Node InnerNode { get;}
        public List<PythonNode> Children { get; set; }
        public PythonNode Parent { get; set; }
        public bool Reference { get; set; }

        public PythonNode(Node innerNode)
        {
            Id = IdCount++;
            InnerNode = innerNode;
            Children = new List<PythonNode>();
            Reference = false;
        }

from refazer.

eglassman avatar eglassman commented on July 25, 2024

Found a way around this. Still annoying, but not a blocker.

from refazer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.