Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Rename import instructions.
Browse files Browse the repository at this point in the history
Following #70.
  • Loading branch information
cristianoc committed Oct 21, 2018
1 parent a3c1223 commit 910e572
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions src/CodeItem.re
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type importAnnotation = {
importPath: ImportPath.t,
};

type wrapJsComponent = {
type importComponent = {
exportType,
importAnnotation,
childrenTyp: typ,
Expand All @@ -38,7 +38,7 @@ type wrapJsComponent = {
fileName: ModuleName.t,
};

type wrapJsValue = {
type importValue = {
valueName: string,
importAnnotation,
typ,
Expand Down Expand Up @@ -79,9 +79,9 @@ type wrapModule = {codeItems: list(t)}
and t =
| ExportType(exportType)
| ExportVariantType(exportVariantType)
| ImportComponent(importComponent)
| ImportType(importType)
| WrapJsComponent(wrapJsComponent)
| WrapJsValue(wrapJsValue)
| ImportValue(importValue)
| WrapReasonComponent(wrapReasonComponent)
| WrapReasonValue(wrapReasonValue)
| WrapVariantLeaf(wrapVariantLeaf);
Expand All @@ -93,9 +93,9 @@ type genTypeKind =

let getPriority = x =>
switch (x) {
| ImportComponent(_)
| ImportType(_)
| WrapJsComponent(_)
| WrapJsValue(_) => "2low"
| ImportValue(_) => "2low"
| ExportType(_)
| ExportVariantType(_)
| WrapReasonComponent(_)
Expand Down Expand Up @@ -149,12 +149,12 @@ let toString = (~language, codeItem: t) =>
switch (codeItem) {
| ExportType({resolvedTypeName, _}) => "ExportType " ++ resolvedTypeName
| ExportVariantType({name, _}) => "ExportVariantType " ++ name
| ImportComponent({importAnnotation, _}) =>
"ImportComponent " ++ (importAnnotation.importPath |> ImportPath.toString)
| ImportType(importType) =>
"ImportType " ++ getImportTypeUniqueName(importType)
| WrapJsComponent({importAnnotation, _}) =>
"WrapJsComponent " ++ (importAnnotation.importPath |> ImportPath.toString)
| WrapJsValue({importAnnotation, _}) =>
"WrapJsValue " ++ (importAnnotation.importPath |> ImportPath.toString)
| ImportValue({importAnnotation, _}) =>
"ImportValue " ++ (importAnnotation.importPath |> ImportPath.toString)
| WrapReasonComponent({fileName, moduleName, _}) =>
"WrapReasonComponent fileName:"
++ (fileName |> ModuleName.toString)
Expand Down
10 changes: 5 additions & 5 deletions src/EmitJs.re
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ let createExportTypeMap = (~language, codeItems): typeMap => {
};
switch (codeItem) {
| CodeItem.ExportType(exportType) => exportType |> addExportType
| ImportType(_)
| ExportVariantType(_)
| WrapJsComponent(_)
| WrapJsValue(_)
| ImportType(_)
| ImportComponent(_)
| ImportValue(_)
| WrapReasonComponent(_)
| WrapReasonValue(_)
| WrapVariantLeaf(_) => exportTypeMap
Expand Down Expand Up @@ -175,7 +175,7 @@ let rec emitCodeItem =
importType,
)

| WrapJsComponent({
| ImportComponent({
exportType,
importAnnotation,
childrenTyp,
Expand Down Expand Up @@ -309,7 +309,7 @@ let rec emitCodeItem =
);
(env, emitters);

| WrapJsValue({valueName, importAnnotation, typ, fileName}) =>
| ImportValue({valueName, importAnnotation, typ, fileName}) =>
let importPath = importAnnotation.importPath;
let (emitters, importedAsName, env) =
switch (language) {
Expand Down
4 changes: 2 additions & 2 deletions src/Translation.re
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ let translatePrimitive =
let propsTypeName = "Props" |> TypeEnv.addModulePath(~typeEnv);

let codeItems = [
CodeItem.WrapJsComponent({
CodeItem.ImportComponent({
exportType: {
opaque: false,
typeVars,
Expand All @@ -381,7 +381,7 @@ let translatePrimitive =
| (_, _, Some(StringPayload(importString))) => {
dependencies: typeExprTranslation.dependencies,
codeItems: [
WrapJsValue({
ImportValue({
valueName,
importAnnotation:
importString |> Annotation.importAnnotationFromString,
Expand Down

0 comments on commit 910e572

Please sign in to comment.