Skip to content

Commit

Permalink
Simple minification added for units
Browse files Browse the repository at this point in the history
  • Loading branch information
JdeH committed Feb 21, 2018
1 parent 568415d commit dab4e1f
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 247 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ Each release, on the other hand, is preceded by at least the following tests:
What's new in the latest commits
================================

- Simple minification added for units (only remove whitespace, names have to stay compatible).
- Unit example expanded to show combination of units and modules, docs adapted accordingly
- Python 3.5 imcompatibility bug fixed
- Python 3.5 incompatibility bug fixed
- Units, making it possible to create compact native JavaScript component frameworks with Transcrypt
- String formatting mini language added as an option (-sf / --sform switch) + autotest
- Div internal improvements and fixes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
// Transcrypt'ed from Python, 2018-02-20 20:51:46
// Transcrypt'ed from Python, 2018-02-21 14:40:33
function animals () {
var __symbols__ = ['__runit__', '__py3.6__', '__esv5__'];
var __all__ = {};
Expand Down Expand Up @@ -141,7 +141,7 @@ function animals () {
get __init__ () {return __get__ (this, function (self) {
self.interpreter_name = 'python';
self.transpiler_name = 'transcrypt';
self.transpiler_version = '3.6.98';
self.transpiler_version = '3.6.100';
self.target_subdir = '__javascript__';
});}
});
Expand All @@ -155,7 +155,6 @@ function animals () {
}
}
);

__nest__ (
__all__,
'org.transcrypt.__standard__', {
Expand Down Expand Up @@ -389,123 +388,6 @@ function animals () {
return __accu0__;
}) ();
};
var complex = __class__ ('complex', [object], {
__module__: __name__,
get __init__ () {return __get__ (this, function (self, real, imag) {
if (typeof imag == 'undefined' || (imag != null && imag .hasOwnProperty ("__kwargtrans__"))) {;
var imag = null;
};
if (imag == null) {
if (py_typeof (real) == complex) {
self.real = real.real;
self.imag = real.imag;
}
else {
self.real = real;
self.imag = 0;
}
}
else {
self.real = real;
self.imag = imag;
}
});},
get __neg__ () {return __get__ (this, function (self) {
return complex (-(self.real), -(self.imag));
});},
get __exp__ () {return __get__ (this, function (self) {
var modulus = Math.exp (self.real);
return complex (modulus * Math.cos (self.imag), modulus * Math.sin (self.imag));
});},
get __log__ () {return __get__ (this, function (self) {
return complex (Math.log (Math.sqrt (self.real * self.real + self.imag * self.imag)), Math.atan2 (self.imag, self.real));
});},
get __pow__ () {return __get__ (this, function (self, other) {
return self.__log__ ().__mul__ (other).__exp__ ();
});},
get __rpow__ () {return __get__ (this, function (self, real) {
return self.__mul__ (Math.log (real)).__exp__ ();
});},
get __mul__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return complex (self.real * other, self.imag * other);
}
else {
return complex (self.real * other.real - self.imag * other.imag, self.real * other.imag + self.imag * other.real);
}
});},
get __rmul__ () {return __get__ (this, function (self, real) {
return complex (self.real * real, self.imag * real);
});},
get __div__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return complex (self.real / other, self.imag / other);
}
else {
var denom = other.real * other.real + other.imag * other.imag;
return complex ((self.real * other.real + self.imag * other.imag) / denom, (self.imag * other.real - self.real * other.imag) / denom);
}
});},
get __rdiv__ () {return __get__ (this, function (self, real) {
var denom = self.real * self.real;
return complex ((real * self.real) / denom, (real * self.imag) / denom);
});},
get __add__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return complex (self.real + other, self.imag);
}
else {
return complex (self.real + other.real, self.imag + other.imag);
}
});},
get __radd__ () {return __get__ (this, function (self, real) {
return complex (self.real + real, self.imag);
});},
get __sub__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return complex (self.real - other, self.imag);
}
else {
return complex (self.real - other.real, self.imag - other.imag);
}
});},
get __rsub__ () {return __get__ (this, function (self, real) {
return complex (real - self.real, -(self.imag));
});},
get __repr__ () {return __get__ (this, function (self) {
return '({}{}{}j)'.format (self.real, (self.imag >= 0 ? '+' : ''), self.imag);
});},
get __str__ () {return __get__ (this, function (self) {
return __repr__ (self).__getslice__ (1, -(1), 1);
});},
get __eq__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return self.real == other;
}
else {
return self.real == other.real && self.imag == other.imag;
}
});},
get __ne__ () {return __get__ (this, function (self, other) {
if (typeof other === 'number') {
return self.real != other;
}
else {
return self.real != other.real || self.imag != other.imag;
}
});},
get conjugate () {return __get__ (this, function (self) {
return complex (self.real, -(self.imag));
});}
});
var __conj__ = function (aNumber) {
if (isinstance (aNumber, complex)) {
return complex (aNumber.real, -(aNumber.imag));
}
else {
return complex (aNumber, 0);
}
};
var __Terminal__ = __class__ ('__Terminal__', [object], {
__module__: __name__,
get __init__ () {return __get__ (this, function (self) {
Expand Down Expand Up @@ -606,11 +488,9 @@ function animals () {
__all__.ValueError = ValueError;
__all__.Warning = Warning;
__all__.__Terminal__ = __Terminal__;
__all__.__conj__ = __conj__;
__all__.__name__ = __name__;
__all__.__sort__ = __sort__;
__all__.__terminal__ = __terminal__;
__all__.complex = complex;
__all__.filter = filter;
__all__.map = map;
__all__.sorted = sorted;
Expand All @@ -619,7 +499,6 @@ function animals () {
}
}
);

var __call__ = function (/* <callee>, <this>, <params>* */) {
var args = [] .slice.apply (arguments);
if (typeof args [0] == 'object' && '__call__' in args [0]) {
Expand Down Expand Up @@ -2375,7 +2254,8 @@ function animals () {
__all__._individuals = _individuals;
__all__.find = find;
__pragma__ ('</all>')
__pragma__ ('<components>')

__pragma__("<components>")
}) ();
return __all__;
}
Expand Down
Loading

0 comments on commit dab4e1f

Please sign in to comment.