Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to support re-exported imports and additional tests #14

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

cd1m0
Copy link
Collaborator

@cd1m0 cd1m0 commented Feb 5, 2021

This pr adds support for re-exported imports and unit alias imports. E.g given the following 3 files:

A.sol
contract Foo {..}

B.sol
import "A.sol" as A;
import {Foo as Boo} from "A.sol";

C.sol
import {A as A1} from "B.sol";
import {Boo as Moo} from "B.sol";
import "B.sol";

contract Test{
     A1.Foo x;
     Moo y;
     Boo z;
}

When re-writing in flat mode, all the different aliases for Foo - A1.Foo, Boo, Moo should just be rewritten to Foo:

pragma solidity 0.7.5;

contract Foo {...}
...
contract Test {
    Foo internal x;
    Foo internal y;
    Foo internal z;
}

Notes:
- this PR also fixes a bug in the grammar for imports
- it introduces the replaceNode function in scribble.ts. That function should eventually be moved to solc-typed-ast.

@cd1m0 cd1m0 requested a review from blitz-1306 February 5, 2021 21:57
Copy link
Contributor

@blitz-1306 blitz-1306 left a comment

Choose a reason for hiding this comment

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

Looks good.

@cd1m0 cd1m0 merged commit 604158d into develop Feb 8, 2021
@cd1m0 cd1m0 deleted the reexported_imports branch February 8, 2021 07:53
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