fix references

pull/1504/head
yann300 3 years ago
parent 71f0e4034c
commit 7f6f3d3ef3
  1. 12
      libs/remix-lib/src/helpers/compilerHelper.ts
  2. 13
      libs/remix-solidity/src/compiler/compiler-input.ts
  3. 2
      libs/remix-solidity/src/index.ts
  4. 8
      libs/remix-solidity/test/compiler-input.ts
  5. 3
      libs/remix-solidity/tsconfig.json
  6. 4
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  7. 4
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -1,5 +1,3 @@
import {Language} from "@remix-project/remix-solidity-ts";
export function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
@ -22,13 +20,3 @@ export function compilerInput (contracts) {
}
})
}
export const Languages = ['Solidity', 'Yul']
export function getValidLanguage (val: string): Language {
if (val !== undefined && val !== null && val) {
const lang = val.slice(0, 1).toUpperCase() + val.slice(1).toLowerCase()
return Languages.indexOf(lang) > -1 ? lang as Language : null
}
return null
}

@ -1,6 +1,6 @@
'use strict'
import { CompilerInput, Source, CompilerInputOptions } from './types'
import { CompilerInput, Source, CompilerInputOptions, Language } from './types'
export default (sources: Source, opts: CompilerInputOptions): string => {
const o: CompilerInput = {
@ -32,3 +32,14 @@ export default (sources: Source, opts: CompilerInputOptions): string => {
}
return JSON.stringify(o)
}
export const Languages = ['Solidity', 'Yul']
export function getValidLanguage (val: string): Language {
if (val !== undefined && val !== null && val) {
const lang = val.slice(0, 1).toUpperCase() + val.slice(1).toLowerCase()
return Languages.indexOf(lang) > -1 ? lang as Language : null
}
return null
}

@ -1,6 +1,6 @@
export { Compiler } from './compiler/compiler'
export { compile } from './compiler/compiler-helpers'
export { default as CompilerInput } from './compiler/compiler-input'
export { default as CompilerInput, getValidLanguage } from './compiler/compiler-input'
export { CompilerAbstract } from './compiler/compiler-abstract'
export * from './compiler/types'
export { promisedMiniXhr, pathToURL, baseURLBin, baseURLWasm, canUseWorker, urlFromVersion } from './compiler/compiler-utils'

@ -1,10 +1,10 @@
'use strict'
import tape from 'tape'
import { getValidLanguage } from "../src/helpers/compilerHelper";
import { Language } from "@remix-project/remix-solidity-ts";
import { getValidLanguage } from "../src/compiler/compiler-input";
import { Language } from "../src/compiler/types";
tape('compilerHelper', function (t) {
t.test('lowerbound', function (st) {
tape('compiler-input', function (t) {
t.test('getValidLanguage', function (st) {
st.plan(9)
const correctYul: Language = 'Yul';

@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"]
"types": ["node"],
"esModuleInterop": true
},
"include": ["**/*.ts"]
}

@ -7,7 +7,7 @@ import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promi
import { compilerReducer, compilerInitialState } from './reducers/compiler'
import { resetEditorMode, listenToEvents } from './actions/compiler'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
import { helpers } from '@remix-project/remix-lib'
import { getValidLanguage } from '@remix-project/remix-solidity'
import './css/style.css'
@ -75,7 +75,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const optimize = params.optimize
const runs = params.runs as string
const evmVersion = params.evmVersion
const language = helpers.compiler.getValidLanguage(params.language)
const language = getValidLanguage(params.language)
return {
...prevState,

@ -1,5 +1,5 @@
import { ICompilerApi } from '@remix-project/remix-lib-ts'
import { helpers } from '@remix-project/remix-lib'
import { getValidLanguage } from '@remix-project/remix-solidity'
const Compiler = require('@remix-project/remix-solidity').Compiler
const EventEmitter = require('events')
@ -42,7 +42,7 @@ export class CompileTabLogic {
this.api.setCompilerParameters({ evmVersion: this.evmVersion })
this.compiler.set('evmVersion', this.evmVersion)
this.language = helpers.compiler.getValidLanguage(this.api.getCompilerParameters().language)
this.language = getValidLanguage(this.api.getCompilerParameters().language)
if (this.language != null) {
this.compiler.set('language', this.language)
}

Loading…
Cancel
Save