Files
sdk/pkg/dev_compiler/test/codegen/expect/misc.js
T
John Messerly 0c148ecef4 Implement modular compilation
Highlights
* compile one module at a time
* use summaries to speed up compiles
* use command runner so we can add more commands later
* some long needed renames and file organization
* various other technical debt has been addressed

Lowlights
* lost node.js runner/tests (node output format still supported)
* possibly lost some closure support/workarounds (format still supported)
* needs more end-to-end tests of the new system

R=vsm@google.com

Review URL: https://codereview.chromium.org/1879373004 .
2016-04-14 11:28:12 -07:00

70 lines
2.0 KiB
JavaScript

dart_library.library('misc', null, /* Imports */[
'dart_sdk'
], function(exports, dart_sdk) {
'use strict';
const core = dart_sdk.core;
const dart = dart_sdk.dart;
const dartx = dart_sdk.dartx;
const misc = Object.create(null);
misc._Uninitialized = class _Uninitialized extends core.Object {
_Uninitialized() {
}
};
dart.setSignature(misc._Uninitialized, {
constructors: () => ({_Uninitialized: [misc._Uninitialized, []]})
});
misc.UNINITIALIZED = dart.const(new misc._Uninitialized());
misc.Generic$ = dart.generic(T => {
class Generic extends core.Object {
get type() {
return misc.Generic;
}
m() {
return core.print(T);
}
}
dart.setSignature(Generic, {
methods: () => ({m: [dart.dynamic, []]})
});
return Generic;
});
misc.Generic = misc.Generic$();
misc.Base = class Base extends core.Object {
Base() {
this.x = 1;
this.y = 2;
}
['=='](obj) {
return dart.is(obj, misc.Base) && obj.x == this.x && obj.y == this.y;
}
};
misc.Derived = class Derived extends core.Object {
Derived() {
this.z = 3;
}
['=='](obj) {
return dart.is(obj, misc.Derived) && obj.z == this.z && super['=='](obj);
}
};
misc._isWhitespace = function(ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
};
dart.fn(misc._isWhitespace, core.bool, [core.String]);
misc.expr = 'foo';
misc._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F', [`\${${misc.expr}}`]: ''}));
misc.main = function() {
core.print(dart.toString(1));
core.print(dart.toString(1.0));
core.print(dart.toString(1.1));
let x = 42;
core.print(dart.equals(x, dart.dynamic));
core.print(dart.equals(x, misc.Generic));
core.print(new (misc.Generic$(core.int))().type);
core.print(dart.equals(new misc.Derived(), new misc.Derived()));
new (misc.Generic$(core.int))().m();
};
dart.fn(misc.main);
// Exports:
exports.misc = misc;
});