-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(GlobalRename): add support for global renames
- Loading branch information
Showing
6 changed files
with
137 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
import { FileAnalyzerImportsResult } from './fileAnalyzer'; | ||
|
||
export class Utils { | ||
static isRelative(file: string) { | ||
return file.startsWith('.'); | ||
} | ||
|
||
static isAllImport(parentImport?: FileAnalyzerImportsResult) { | ||
return ( | ||
!parentImport || | ||
(parentImport !== null && | ||
parentImport.globalRenameImport === null && | ||
parentImport.namedImports === null) | ||
); | ||
} | ||
|
||
static isRenameGlobalImport(parentImport?: FileAnalyzerImportsResult) { | ||
return parentImport && parentImport.globalRenameImport !== null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
pragma solidity ^0.4.11; | ||
|
||
contract GlobalRenamed$Ownable { | ||
address public owner; | ||
|
||
function Ownable() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function transferOwnership(address newOwner) onlyOwner { | ||
if (newOwner != address(0)) { | ||
owner = newOwner; | ||
} | ||
} | ||
|
||
} | ||
|
||
contract MyOwned is GlobalRenamed$Ownable { | ||
string public constant name = "My Owned"; | ||
|
||
function MyOwned() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pragma solidity ^0.4.11; | ||
|
||
import * as GlobalRenamed from "./imports/ownable.sol"; | ||
|
||
contract MyOwned is GlobalRenamed.Ownable { | ||
string public constant name = "My Owned"; | ||
|
||
function MyOwned() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters