Skip to content

Expose funs#70

Merged
leonardt merged 3 commits into
masterfrom
expose-funs
Feb 28, 2019
Merged

Expose funs#70
leonardt merged 3 commits into
masterfrom
expose-funs

Conversation

@rdaly525
Copy link
Copy Markdown
Collaborator

This adds the following functions:
inline_instance
module.params
context.new_namespace

@rdaly525 rdaly525 requested a review from leonardt February 28, 2019 16:45
@rdaly525
Copy link
Copy Markdown
Collaborator Author

Depends on rdaly525/coreir#702

Copy link
Copy Markdown
Owner

@leonardt leonardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good to merge modulo minor nitpick about assert->typeerror

Comment thread coreir/wireable.py Outdated


def inline_instance(instance):
assert isinstance(instance,Instance)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this raise a TypeError? If you have time, a more general solution might be to create a simple decorator in a file util.py which we can use to type check functions like this, like @typecheck(<expected_types>...).

Alternatively, I think we could annotate the type using Python 3 syntax, and use mypy to do it.

But a simple if <cond>: raise TypeErrror will work fine.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixed

Comment thread tests/test_inline.py
for i in range(5):
inst = top_def.instances[0]
coreir.inline_instance(inst)
assert num_instances() == 6+i
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test!

@leonardt
Copy link
Copy Markdown
Owner

Can you rerun the build after you make a new release of coreir with the new C-API methods? Should be good to merge/release after that.

@rdaly525
Copy link
Copy Markdown
Collaborator Author

@leonardt Passes!

@leonardt leonardt merged commit 1276c2b into master Feb 28, 2019
@leonardt leonardt deleted the expose-funs branch February 28, 2019 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants