Use better workaround for Transcrypt bug 387

Avoid modifying Transcrypt compiler code
This commit is contained in:
RunasSudo 2017-12-04 13:52:10 +11:00
parent 85c8f4638f
commit 41c588d0bf
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,10 @@ for f in eos.js_tests; do
# Transcrypt bug #407
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__impl__(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__implpy_(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
# Transcrypt bug #387
perl -0777 -pi -e 's/var __nest__ = function \(headObject, tailNames, value\) \{/var __nest__ = function (headObject, tailNames, value) { if (headObject === __all__ && value.__all__) { value.__all__.__module__ = tailNames; }/g' eos/__javascript__/$f.js
perl -0777 -pi -e "s/var (.*?) = __class__ \('\g1', \[(.*?)\], \{/var "'$1'" = __class__ ('"'$1'"', ["'$2'"], { __module__: __all__.__module__,/g" eos/__javascript__/$f.js
done
cp eos/__javascript__/eos.js_tests.js eosweb/core/static/js/eosjs.js

View File

@ -170,7 +170,7 @@ class DateTimeField(Field):
class EosObjectType(type):
def __new__(meta, name, bases, attrs):
cls = type.__new__(meta, name, bases, attrs)
cls._name = ((cls.__module__ if is_python else meta.__next_class_module__) + '.' + cls.__name__).replace('.js.', '.').replace('.python.', '.') #TNYI: module and qualname
cls._name = (cls.__module__ + '.' + cls.__name__).replace('.js.', '.').replace('.python.', '.') #TNYI: qualname
if name != 'EosObject':
EosObject.objects[cls._name] = cls
if '_db_name' not in attrs: