Skip to content

Instantly share code, notes, and snippets.

@DanTup
Created November 13, 2017 17:40
Show Gist options
  • Save DanTup/b0a29c8322edbf2a6629781f2d34a2c2 to your computer and use it in GitHub Desktop.
Save DanTup/b0a29c8322edbf2a6629781f2d34a2c2 to your computer and use it in GitHub Desktop.
// Generated by dart2js, the Dart to JavaScript compiler version: 1.24.2.
// The code supports the following hooks:
// dartPrint(message):
// if this function is defined it is called instead of the Dart [print]
// method.
//
// dartMainRunner(main, args):
// if this function is defined, the Dart [main] method will not be invoked
// directly. Instead, a closure that will invoke [main], and its arguments
// [args] is passed to [dartMainRunner].
//
// dartDeferredLibraryLoader(uri, successCallback, errorCallback):
// if this function is defined, it will be called when a deferred library
// is loaded. It should load and eval the javascript of `uri`, and call
// successCallback. If it fails to do so, it should call errorCallback with
// an error.
//
// defaultPackagesBase:
// Override the location where `package:` uris are resolved from. By default
// they are resolved under "packages/" from the current window location.
(function() {
// /* ::norenaming:: */
var supportsDirectProtoAccess = function() {
var cls = function() {
};
cls.prototype = {p: {}};
var object = new cls();
if (!(object.__proto__ && object.__proto__.p === cls.prototype.p))
return false;
try {
if (typeof navigator != "undefined" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Chrome/") >= 0)
return true;
if (typeof version == "function" && version.length == 0) {
var v = version();
if (/^\d+\.\d+\.\d+\.\d+$/.test(v))
return true;
}
} catch (_) {
}
return false;
}();
function map(x) {
x = Object.create(null);
x.x = 0;
delete x.x;
return x;
}
// The global objects start as so-called "slow objects". For V8, this
// means that it won't try to make map transitions as we add properties
// to these objects. Later on, we attempt to turn these objects into
// fast objects by calling "convertToFastObject" (see
// [emitConvertToFastObjectFunction]).
var A = map();
var B = map();
var C = map();
var D = map();
var E = map();
var F = map();
var G = map();
var H = map();
var J = map();
var K = map();
var L = map();
var M = map();
var N = map();
var O = map();
var P = map();
var Q = map();
var R = map();
var S = map();
var T = map();
var U = map();
var V = map();
var W = map();
var X = map();
var Y = map();
var Z = map();
function Isolate() {
}
init();
// Constructors are generated at runtime.
function setupProgram(programData, typesOffset) {
"use strict";
function processStatics(descriptor, processedClasses) {
var properties = Object.keys(descriptor);
for (var i = 0; i < properties.length; i++) {
var property = properties[i];
if (property === "^")
continue;
var element = descriptor[property];
var firstChar = property.charCodeAt(0);
var previousProperty;
if (firstChar === 43) {
mangledGlobalNames[previousProperty] = property.substring(1);
var flag = descriptor[property];
if (flag > 0)
descriptor[previousProperty].$reflectable = flag;
if (element && element.length)
init.typeInformation[previousProperty] = element;
} else if (firstChar === 42) {
globalObject[previousProperty].$defaultValues = element;
var optionalMethods = descriptor.$methodsWithOptionalArguments;
if (!optionalMethods)
descriptor.$methodsWithOptionalArguments = optionalMethods = {};
optionalMethods[property] = previousProperty;
} else if (typeof element === "function") {
globalObject[previousProperty = property] = element;
functions.push(property);
init.globalFunctions[property] = element;
} else if (element.constructor === Array) {
} else {
}
}
}
var functionCounter = 0;
if (!init.libraries)
init.libraries = [];
if (!init.mangledNames)
init.mangledNames = map();
if (!init.mangledGlobalNames)
init.mangledGlobalNames = map();
if (!init.statics)
init.statics = map();
if (!init.typeInformation)
init.typeInformation = map();
if (!init.globalFunctions)
init.globalFunctions = map();
var libraries = init.libraries;
var mangledNames = init.mangledNames;
var mangledGlobalNames = init.mangledGlobalNames;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var length = programData.length;
var processedClasses = map();
processedClasses.collected = map();
processedClasses.pending = map();
processedClasses.constructorsList = [];
processedClasses.combinedConstructorFunction = "function $reflectable(fn){fn.$reflectable=1;return fn};\n" + "var $desc;\n";
for (var i = 0; i < length; i++) {
var data = programData[i];
var name = data[0];
var uri = data[1];
var metadata = data[2];
var globalObject = data[3];
var descriptor = data[4];
var isRoot = !!data[5];
var fields = descriptor && descriptor["^"];
if (fields instanceof Array)
fields = fields[0];
var classes = [];
var functions = [];
processStatics(descriptor, processedClasses);
libraries.push([name, uri, classes, functions, metadata, fields, isRoot, globalObject]);
}
}
Isolate.functionThatReturnsNull = function() {
};
var dart = [["dart2js._js_primitives", "dart:_js_primitives",, H, {
"^": "",
printString: function(string) {
if (typeof dartPrint == "function") {
dartPrint(string);
return;
}
if (typeof console == "object" && typeof console.log != "undefined") {
console.log(string);
return;
}
if (typeof window == "object")
return;
if (typeof print == "function") {
print(string);
return;
}
throw "Unable to print message: " + String(string);
}
}], ["", "main.dart",, F, {
"^": "",
main: function() {
H.printString("Hello, world");
}
}, 1]];
setupProgram(dart, 0);
// getInterceptor methods
// Output contains no constant list.
var $ = Isolate.$isolateProperties;
// No constants in program.
$ = null;
init.isHunkLoaded = function(hunkHash) {
return !!$dart_deferred_initializers$[hunkHash];
};
init.deferredInitialized = new Object(null);
init.isHunkInitialized = function(hunkHash) {
return init.deferredInitialized[hunkHash];
};
init.initializeLoadedHunk = function(hunkHash) {
$dart_deferred_initializers$[hunkHash]($globals$, $);
init.deferredInitialized[hunkHash] = true;
};
init.deferredLibraryUris = {};
init.deferredLibraryHashes = {};
// Empty type-to-interceptor map.
// No lazy statics.
Isolate = Isolate.$finishIsolateConstructor(Isolate);
$ = new Isolate();
init.metadata = [];
init.types = [];
function convertToFastObject(properties) {
function MyClass() {
}
MyClass.prototype = properties;
new MyClass();
return properties;
}
function convertToSlowObject(properties) {
properties.__MAGIC_SLOW_PROPERTY = 1;
delete properties.__MAGIC_SLOW_PROPERTY;
return properties;
}
A = convertToFastObject(A);
B = convertToFastObject(B);
C = convertToFastObject(C);
D = convertToFastObject(D);
E = convertToFastObject(E);
F = convertToFastObject(F);
G = convertToFastObject(G);
H = convertToFastObject(H);
J = convertToFastObject(J);
K = convertToFastObject(K);
L = convertToFastObject(L);
M = convertToFastObject(M);
N = convertToFastObject(N);
O = convertToFastObject(O);
P = convertToFastObject(P);
Q = convertToFastObject(Q);
R = convertToFastObject(R);
S = convertToFastObject(S);
T = convertToFastObject(T);
U = convertToFastObject(U);
V = convertToFastObject(V);
W = convertToFastObject(W);
X = convertToFastObject(X);
Y = convertToFastObject(Y);
Z = convertToFastObject(Z);
function init() {
Isolate.$isolateProperties = Object.create(null);
init.allClasses = map();
init.getTypeFromName = function(name) {
return init.allClasses[name];
};
init.interceptorsByTag = map();
init.leafTags = map();
init.finishedClasses = map();
Isolate.$finishIsolateConstructor = function(oldIsolate) {
var isolateProperties = oldIsolate.$isolateProperties;
function Isolate() {
var staticNames = Object.keys(isolateProperties);
for (var i = 0; i < staticNames.length; i++) {
var staticName = staticNames[i];
this[staticName] = isolateProperties[staticName];
}
var lazies = init.lazies;
var lazyInitializers = lazies ? Object.keys(lazies) : [];
for (var i = 0; i < lazyInitializers.length; i++)
this[lazies[lazyInitializers[i]]] = null;
function ForceEfficientMap() {
}
ForceEfficientMap.prototype = this;
new ForceEfficientMap();
for (var i = 0; i < lazyInitializers.length; i++) {
var lazyInitName = lazies[lazyInitializers[i]];
this[lazyInitName] = isolateProperties[lazyInitName];
}
}
Isolate.prototype = oldIsolate.prototype;
Isolate.prototype.constructor = Isolate;
Isolate.$isolateProperties = isolateProperties;
Isolate.functionThatReturnsNull = oldIsolate.functionThatReturnsNull;
return Isolate;
};
}
// BEGIN invoke [main].
(function(callback) {
if (typeof document === "undefined") {
callback(null);
return;
}
if (typeof document.currentScript != 'undefined') {
callback(document.currentScript);
return;
}
var scripts = document.scripts;
function onLoad(event) {
for (var i = 0; i < scripts.length; ++i)
scripts[i].removeEventListener("load", onLoad, false);
callback(event.target);
}
for (var i = 0; i < scripts.length; ++i)
scripts[i].addEventListener("load", onLoad, false);
})(function(currentScript) {
init.currentScript = currentScript;
if (typeof dartMainRunner === "function")
dartMainRunner(F.main, []);
else
F.main([]);
});
// END invoke [main].
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment