Created
December 13, 2015 20:05
-
-
Save ochafik/099900f4cb9bb17016ae to your computer and use it in GitHub Desktop.
move_ddc_runtime_js_to_dart.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# {rtti,types,classes,errors,generators,operations,runtime} | |
for lib in rtti types classes errors generators operations runtime ; do | |
#_internal/compiler/js_lib/runtime.dart | |
js=lib/runtime/dart/_$lib.js | |
dart=tool/input_sdk/private/$lib.dart | |
if [[ ! -f $dart || "$FORCE" == "1" ]]; then | |
# ( cat $js | grep '\.\.\.' > /dev/null ) || | |
cat $js | \ | |
# egrep -v '^ exports.' | | |
egrep -v "'use strict'" | \ | |
egrep -v 'const assert = ' | \ | |
sed -E "s/^dart_library.library\('dart\/([^']+)'.*/library dart.\1;/" | \ | |
sed -E "s/^ 'dart\/_([^']+)',?/import '\1.dart';/" | \ | |
egrep -v "^ 'dart/core'," | \ | |
sed -E "s/\], \/\* Lazy Imports \*\/\[/import 'dart:_foreign_helper' show JS;/" | \ | |
sed -E 's/^\], (function\(exports,.*)$/\/\/ \1/' | \ | |
sed -E 's/\$/\\\$/' | \ | |
sed -E 's/^});//' | \ | |
sed -E 's/^ (\/\*\*| \*| \*\/)/ \/\/\//' | \ | |
sed -E 's/^ (exports\..*)$/ \/\/ \1/' | \ | |
sed -E "s/^ (let|const) ([^ ]+) = Symbol\('([^']+)'\);/ final \2 = JS('', 'Symbol(\"\3\")');/" | \ | |
sed -E "s/^ (let|const) ([^ ]+) = ([^;]+);/ final \2 = JS('', '\3');/" | \ | |
sed -E 's/^ function ([a-zA-Z_]+) *\(([^)]*)\)\s*/ \1(\2) => JS\('"''"', '"'''"'(() =>/' | \ | |
sed -E 's/^ \}$/ })()'"'''"');/' \ | |
> $dart | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment