Commit 9c628105 authored by aniket-engg's avatar aniket-engg Committed by Aniket

sourceMappingDecoder not a class

parent 8b1df55f
'use strict' 'use strict'
const yo = require('yo-yo') const yo = require('yo-yo')
const remixDebug = require('@remix-project/remix-debug') import { sourceMappingDecoder } from '@remix-project/remix-debug'
const SourceMappingDecoder = remixDebug.SourceMappingDecoder
const globalRegistry = require('../../global/registry') const globalRegistry = require('../../global/registry')
const css = require('./styles/contextView-styles') const css = require('./styles/contextView-styles')
...@@ -28,7 +27,7 @@ class ContextView { ...@@ -28,7 +27,7 @@ class ContextView {
this._view = null this._view = null
this._nodes = null this._nodes = null
this._current = null this._current = null
this.sourceMappingDecoder = SourceMappingDecoder this.sourceMappingDecoder = sourceMappingDecoder
this.previousElement = null this.previousElement = null
this.contextualListener.event.register('contextChanged', nodes => { this.contextualListener.event.register('contextChanged', nodes => {
this.show() this.show()
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
const remixdebug = require('@remix-project/remix-debug') import { sourceMappingDecoder } from '@remix-project/remix-debug'
const { AstWalker } = require('@remix-project/remix-astwalker') const { AstWalker } = require('@remix-project/remix-astwalker')
const csjs = require('csjs-inject') const csjs = require('csjs-inject')
const SourceMappingDecoder = remixdebug.SourceMappingDecoder
const EventManager = require('../../lib/events') const EventManager = require('../../lib/events')
const globalRegistry = require('../../global/registry') const globalRegistry = require('../../global/registry')
...@@ -39,7 +38,7 @@ class ContextualListener extends Plugin { ...@@ -39,7 +38,7 @@ class ContextualListener extends Plugin {
this._activeHighlights = [] this._activeHighlights = []
this.editor.event.register('contentChanged', () => { this._stopHighlighting() }) this.editor.event.register('contentChanged', () => { this._stopHighlighting() })
this.sourceMappingDecoder = SourceMappingDecoder this.sourceMappingDecoder = sourceMappingDecoder
this.astWalker = new AstWalker() this.astWalker = new AstWalker()
} }
......
'use strict' 'use strict'
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../package.json' import * as packageJson from '../../../../package.json'
var SourceMappingDecoder = require('@remix-project/remix-debug').SourceMappingDecoder import { sourceMappingDecoder } from '@remix-project/remix-debug'
const profile = { const profile = {
name: 'offsetToLineColumnConverter', name: 'offsetToLineColumnConverter',
...@@ -14,7 +14,7 @@ export class OffsetToLineColumnConverter extends Plugin { ...@@ -14,7 +14,7 @@ export class OffsetToLineColumnConverter extends Plugin {
constructor () { constructor () {
super(profile) super(profile)
this.lineBreakPositionsByContent = {} this.lineBreakPositionsByContent = {}
this.sourceMappingDecoder = SourceMappingDecoder this.sourceMappingDecoder = sourceMappingDecoder
} }
/** /**
......
...@@ -7,7 +7,7 @@ import { StorageViewer } from './storage/storageViewer' ...@@ -7,7 +7,7 @@ import { StorageViewer } from './storage/storageViewer'
import { StorageResolver } from './storage/storageResolver' import { StorageResolver } from './storage/storageResolver'
import * as SolidityDecoder from './solidity-decoder' import * as SolidityDecoder from './solidity-decoder'
import { BreakpointManager } from './code/breakpointManager' import { BreakpointManager } from './code/breakpointManager'
import * as SourceMappingDecoder from './source/sourceMappingDecoder' import * as sourceMappingDecoder from './source/sourceMappingDecoder'
import * as traceHelper from './trace/traceHelper' import * as traceHelper from './trace/traceHelper'
/* /*
...@@ -21,7 +21,7 @@ import * as traceHelper from './trace/traceHelper' ...@@ -21,7 +21,7 @@ import * as traceHelper from './trace/traceHelper'
export = { export = {
init, init,
traceHelper, traceHelper,
SourceMappingDecoder, sourceMappingDecoder,
EthDebugger, EthDebugger,
TransactionDebugger, TransactionDebugger,
/** /**
......
...@@ -5,11 +5,10 @@ import * as sourceMappingDecoder from '../src/source/sourceMappingDecoder' ...@@ -5,11 +5,10 @@ import * as sourceMappingDecoder from '../src/source/sourceMappingDecoder'
const compiler = require('solc') const compiler = require('solc')
const compilerInput = require('./helpers/compilerHelper').compilerInput const compilerInput = require('./helpers/compilerHelper').compilerInput
tape('SourceMappingDecoder', function (t) { tape('sourceMappingDecoder', function (t) {
t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) { t.test('sourceMappingDecoder.findNodeAtInstructionIndex', function (st) {
let output = compiler.compile(compilerInput(contracts)) let output = compiler.compile(compilerInput(contracts))
output = JSON.parse(output) output = JSON.parse(output)
// const sourceMappingDecoder = new SourceMappingDecoder()
let node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol']) let node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol'])
st.equal(node, null) st.equal(node, null)
node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 80, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol']) node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 80, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol'])
...@@ -23,7 +22,6 @@ tape('SourceMappingDecoder', function (t) { ...@@ -23,7 +22,6 @@ tape('SourceMappingDecoder', function (t) {
const testSourceMapping = {} const testSourceMapping = {}
t.test('sourceMappingDecoder', function (st) { t.test('sourceMappingDecoder', function (st) {
st.plan(36) st.plan(36)
// const sourceMappingDecoder = new SourceMappingDecoder()
console.log('test decompressAll') console.log('test decompressAll')
let result = sourceMappingDecoder.decompressAll(sourceMapping.mapping) let result = sourceMappingDecoder.decompressAll(sourceMapping.mapping)
st.equal(result[0].start, 0) st.equal(result[0].start, 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment