Merge pull request #1739 from ethereum/swap_it_vyper_compiler

vyper compiler on swap_it
pull/1/head
yann300 6 years ago committed by GitHub
commit f09f7616f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      src/app/components/plugin-manager-proxy.js
  2. 2
      src/app/editor/contextView.js
  3. 7
      src/app/editor/contextualListener.js
  4. 1
      src/app/staticanalysis/staticAnalysisView.js
  5. 2
      src/app/tabs/compile-tab.js
  6. 10
      src/app/ui/landing-page/landing-page.js
  7. 4
      src/remixAppManager.js

@ -8,20 +8,26 @@ class PluginManagerProxy {
constructor () {
this.event = new EventManager()
this._listeners = {}
this._listeners['vyper'] = (data) => {
registry.get('compilersartefacts').api['__last'] = new CompilerAbstract(data.language, data.result, data.content)
this.event.trigger('sendCompilationResult', [data.title, data.content, data.language, data.result])
}
this._listeners['solidity'] = (file, source, languageVersion, data) => {
registry.get('compilersartefacts').api['__last'] = new CompilerAbstract(languageVersion, data, source)
this.event.trigger('sendCompilationResult', [file, source, languageVersion, data])
}
}
register (instance) {
var event = this.event
this._listener = (file, source, languageVersion, data) => {
registry.get('compilersartefacts').api['__last'] = new CompilerAbstract(languageVersion, data, source)
event.trigger('sendCompilationResult', [file, source, languageVersion, data])
register (name, instance) {
if (this._listeners[name]) {
instance.events.on('compilationFinished', this._listeners[name])
}
instance.events.on('compilationFinished', this._listener)
}
unregister (instance) {
if (!this._listener) {
instance.events.off('compilationFinished', this._listener)
unregister (name, instance) {
if (this._listeners[name]) {
instance.events.off('compilationFinished', this._listeners[name])
}
}

@ -97,7 +97,7 @@ class ContextView {
}
}
let lastCompilationResult = this._deps.compilersArtefacts['__last']
if (lastCompilationResult && lastCompilationResult.data) {
if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0 && lastCompilationResult.data) {
const lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(
position,
position.file,

@ -27,6 +27,7 @@ class ContextualListener {
this._activeHighlights = []
this.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => {
if (languageVersion.indexOf('soljson') !== 0) return
this._stopHighlighting()
this._index = {
Declarations: {},
@ -40,7 +41,7 @@ class ContextualListener {
this.sourceMappingDecoder = new SourceMappingDecoder()
this.astWalker = new AstWalker()
setInterval(() => {
if (this._deps.compilersArtefacts['__last']) {
if (this._deps.compilersArtefacts['__last'] && this._deps.compilersArtefacts['__last'].languageversion.indexOf('soljson') === 0) {
this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts['__last'], this._deps.config.get('currentFile'))
}
}, 1000)
@ -105,14 +106,14 @@ class ContextualListener {
const position = this.sourceMappingDecoder.decode(node.src)
const eventId = this._highlightInternal(position, node)
let lastCompilationResult = this._deps.compilersArtefacts['__last']
if (eventId && lastCompilationResult) {
if (eventId && lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
this._activeHighlights.push({ eventId, position, fileTarget: lastCompilationResult.getSourceName(position.file), nodeId: node.id })
}
}
_highlightInternal (position, node) {
let lastCompilationResult = this._deps.compilersArtefacts['__last']
if (lastCompilationResult) {
if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
let lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts())
let css = 'highlightreference'
if (node.children && node.children.length) {

@ -30,6 +30,7 @@ function staticAnalysisView (localRegistry) {
self.lastCompilationResult = null
self.lastCompilationSource = null
$('#staticanalysisresult').empty()
if (languageVersion.indexOf('soljson') !== 0) return
self.lastCompilationResult = data
self.lastCompilationSource = source
if (self.view.querySelector('#autorunstaticanalysis').checked) {

@ -81,7 +81,7 @@ class CompileTab {
this.compiler.event.register('compilationFinished', (success, data, source) => {
if (success) {
// forwarding the event to the appManager infra
this.events.emit('compilationFinished', source.target, source, this.data.selectedVersion, data)
this.events.emit('compilationFinished', source.target, source, 'soljson', data)
// Store the contracts
this.data.contractsDetails = {}
this.compiler.visitContracts((contract) => {

@ -18,8 +18,12 @@ var css = csjs`
font-family : "Lucida Console", Monaco, monospace;
}
.logo {
position: absolute;
opacity: 0.3;
position : absolute;
opacity : 0.3;
z-index : 0;
}
.section {
z-index : 10;
}
`
@ -36,7 +40,7 @@ class LandingPage {
`
for (var i = 0; i < this.sections.length; i++) {
totalLook.appendChild(yo`
<div>
<div class="${css.section}" >
${this.sections[i].render()}
</div>
`)

@ -26,8 +26,8 @@ export class RemixAppManager extends AppManagerApi {
setActive (name, isActive) {
const entity = this.getEntity(name)
// temp
if (entity && name === 'solidity') {
isActive ? this.data.proxy.register(entity.api) : this.data.proxy.unregister(entity.api)
if (entity && (name === 'solidity' || name === 'vyper')) {
isActive ? this.data.proxy.register(name, entity.api) : this.data.proxy.unregister(name, entity.api)
}
isActive ? this.store.activate(name) : this.store.deactivate(name)
if (!isActive) {

Loading…
Cancel
Save