Files
sdk/pkg/dev_compiler/test/codegen/expect/misc.js
T
Olivier Chafik 7add882a7a Move runtime js files down to lib/runtime/dart
Prepare for writing all the runtime in Dart:
- Move js runtime files to lib/runtime/dart (dart_runtime.js ->
dart/_runtime.js),
- Use rest params instead of arguments slicing in a couple of places.

BUG=https://github.com/dart-lang/dev_compiler/issues/310
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1413683006 .
2015-10-29 16:44:49 +00:00

66 lines
1.9 KiB
JavaScript

dart_library.library('misc', null, /* Imports */[
"dart/_runtime",
'dart/core'
], /* Lazy imports */[
], function(exports, dart, core) {
'use strict';
let dartx = dart.dartx;
class _Uninitialized extends core.Object {
_Uninitialized() {
}
}
dart.setSignature(_Uninitialized, {
constructors: () => ({_Uninitialized: [_Uninitialized, []]})
});
let UNINITIALIZED = dart.const(new _Uninitialized());
let Generic$ = dart.generic(function(T) {
class Generic extends core.Object {
get type() {
return Generic$();
}
}
return Generic;
});
let Generic = Generic$();
class Base extends core.Object {
Base() {
this.x = 1;
this.y = 2;
}
['=='](obj) {
return dart.is(obj, Base) && dart.equals(dart.dload(obj, 'x'), this.x) && dart.equals(dart.dload(obj, 'y'), this.y);
}
}
class Derived extends core.Object {
Derived() {
this.z = 3;
}
['=='](obj) {
return dart.is(obj, Derived) && dart.equals(dart.dload(obj, 'z'), this.z) && super['=='](obj);
}
}
function _isWhitespace(ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
dart.fn(_isWhitespace, core.bool, [core.String]);
let _escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'}));
function main() {
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, Generic));
core.print(new (Generic$(core.int))().type);
core.print(dart.equals(new Derived(), new Derived()));
}
dart.fn(main);
// Exports:
exports.UNINITIALIZED = UNINITIALIZED;
exports.Generic$ = Generic$;
exports.Generic = Generic;
exports.Base = Base;
exports.Derived = Derived;
exports.main = main;
});