Merge branch 'fsfallback' of https://github.com/ethereum/remix-project into fsfallback

pull/2113/head
filip mertens 3 years ago
commit 40b9b41f85
  1. 5
      apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts
  2. 3
      apps/remix-ide/src/app/files/fileManager.ts
  3. 1
      apps/remix-ide/src/app/files/workspaceFileProvider.js
  4. 4
      libs/remix-debug/src/debugger/stepManager.ts
  5. 8
      libs/remix-debug/src/solidity-decoder/decodeInfo.ts
  6. 12
      libs/remix-debug/src/solidity-decoder/types/FunctionType.ts
  7. 33
      libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx

@ -12,7 +12,10 @@ class GoToVmTraceStep extends EventEmitter {
function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number, done: VoidFunction) {
browser.execute(function (step) { (document.getElementById('slider') as HTMLInputElement).value = (step - 1).toString() }, [step])
.setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW))
.pause(1000)
.execute((step) => {
(document.querySelector('*[data-id="slider"]') as any).internal_onmouseup({ target: { value: step }})
}, [step])
.pause(10000)
.perform(() => {
done()
})

@ -608,9 +608,10 @@ class FileManager extends Plugin {
this.events.emit('noFileSelected')
} else {
file = this.normalize(file)
await this.saveCurrentFile()
const resolved = this.getPathFromUrl(file)
file = resolved.file
await this.saveCurrentFile()
if (this.currentFile() === file) return
const provider = resolved.provider
this._deps.config.set('currentFile', file)
this.openedFiles[file] = file

@ -32,6 +32,7 @@ class WorkspaceFileProvider extends FileProvider {
removePrefix (path) {
path = path.replace(/^\/|\/$/g, '') // remove first and last slash
path = path.replace(/^\.\/+/, '') // remove ./ from start of string
if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path
const splitPath = path.split('/')

@ -121,6 +121,7 @@ export class DebuggerStepManager {
if (solidityMode) {
step = this.resolveToReducedTrace(step, -1)
}
if (this.currentStepIndex === step) return
this.currentStepIndex = step
this.triggerStepChanged(step)
}
@ -136,6 +137,7 @@ export class DebuggerStepManager {
if (solidityMode) {
step = this.resolveToReducedTrace(step, 1)
}
if (this.currentStepIndex === step) return
this.currentStepIndex = step
this.triggerStepChanged(step)
}
@ -146,12 +148,14 @@ export class DebuggerStepManager {
if (solidityMode) {
step = this.resolveToReducedTrace(step, 0)
}
if (this.currentStepIndex === step) return
this.currentStepIndex = step
this.triggerStepChanged(step)
}
jumpTo (step) {
if (!this.traceManager.inRange(step)) return
if (this.currentStepIndex === step) return
this.currentStepIndex = step
this.triggerStepChanged(step)
}

@ -11,6 +11,7 @@ import { Struct as StructType } from './types/Struct'
import { Int as IntType } from './types/Int'
import { Uint as UintType } from './types/Uint'
import { Mapping as MappingType } from './types/Mapping'
import { FunctionType } from './types/FunctionType'
import { extractLocation, removeLocation } from './types/util'
/**
@ -78,6 +79,10 @@ function bool (type) {
return new BoolType()
}
function functionType (type, stateDefinitions, contractName, location) {
return new FunctionType(type, stateDefinitions, contractName, location)
}
/**
* DynamicByteArray decode the given @arg type
*
@ -300,7 +305,8 @@ function parseType (type, stateDefinitions, contractName, location) {
struct: struct,
int: int,
uint: uint,
mapping: mapping
mapping: mapping,
function: functionType
}
const currentType = typeClass(type)
if (currentType === null) {

@ -0,0 +1,12 @@
'use strict'
import { ValueType } from './ValueType'
export class FunctionType extends ValueType {
constructor (type, stateDefinitions, contractName, location) {
super(1, 8, 'function')
}
decodeValue (value) {
return 'at program counter ' + value
}
}

@ -1,47 +1,42 @@
import React, { useState, useEffect, useRef } from 'react' // eslint-disable-line
export const Slider = ({ jumpTo, sliderValue, traceLength }) => {
const [state, setState] = useState({
currentValue: 0
})
const onChangeId = useRef(null)
const slider = useRef(null)
useEffect(() => {
setValue(sliderValue)
}, [sliderValue])
const setValue = (value) => {
if (value === state.currentValue) return
setState(prevState => {
return { ...prevState, currentValue: value }
})
jumpTo && jumpTo(value)
}
const handleChange = (e) => {
if (value === slider.current.value) return
slider.current.value = value
if (onChangeId.current) {
window.clearTimeout(onChangeId.current)
clearTimeout(onChangeId.current)
}
((value) => {
onChangeId.current = setTimeout(() => {
console.log(value)
value = parseInt(value)
setValue(value)
jumpTo && jumpTo(value)
}, 100)
})(e.target.value)
})(value)
}
const handleChange = (e) => {
setValue(parseInt(e.target.value))
}
if (slider.current) slider.current.internal_onmouseup = handleChange
return (
<div>
<input id='slider'
data-id="slider"
className='w-100 my-0'
ref={slider}
type='range'
min={0}
max={traceLength ? traceLength - 1 : 0}
value={state.currentValue}
onChange={handleChange}
onMouseUp={handleChange}
disabled={traceLength ? traceLength === 0 : true}
/>
</div>

Loading…
Cancel
Save