Files
sdk/pkg/dev_compiler/test/codegen_expected/node_modules.js
T
Vijay Menon 1ec614fd7b Enable DDC output to run on v8/d8 using ES6 modules
Fixes #27309

V8 / D8 tip supports ES6 modules natively.  It's a little cumbersome
to set up, but hello world runs.  :-)

> ln -s $DDC_PATH/lib/js/es6/ddc_sdk.js ddc_sdk
> dart  $DDC_PATH/bin/dartdevc.dart --dart-sdk-summary $DDC_PATH/lib/sdk/ddc_sdk.sum --modules es6 -o hello hello.dart
> cat > run.js
import { hello } from 'hello';
hello.main();
> d8 --module run.js

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2701963002 .
2017-02-17 16:54:21 -08:00

54 lines
1.6 KiB
JavaScript

'use strict';
const dart_sdk = require('dart_sdk');
const core = dart_sdk.core;
const dart = dart_sdk.dart;
const dartx = dart_sdk.dartx;
const node_modules = Object.create(null);
let B = () => (B = dart.constFn(node_modules.B$()))();
let _B = () => (_B = dart.constFn(node_modules._B$()))();
let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
let VoidToString = () => (VoidToString = dart.constFn(dart.definiteFunctionType(core.String, [])))();
node_modules.Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int}));
node_modules.A = class A extends core.Object {};
node_modules._A = class _A extends core.Object {};
node_modules.B$ = dart.generic(T => {
class B extends core.Object {}
dart.addTypeTests(B);
return B;
});
node_modules.B = B();
node_modules._B$ = dart.generic(T => {
class _B extends core.Object {}
dart.addTypeTests(_B);
return _B;
});
node_modules._B = _B();
node_modules.f = function() {
};
dart.fn(node_modules.f, VoidTodynamic());
node_modules._f = function() {
};
dart.fn(node_modules._f, VoidTodynamic());
node_modules.constant = "abc";
node_modules.finalConstant = "abc";
dart.defineLazy(node_modules, {
get lazy() {
return dart.fn(() => {
core.print('lazy');
return "abc";
}, VoidToString())();
}
});
node_modules.mutable = "abc";
dart.defineLazy(node_modules, {
get lazyMutable() {
return dart.fn(() => {
core.print('lazyMutable');
return "abc";
}, VoidToString())();
},
set lazyMutable(_) {}
});
// Exports:
exports.node_modules = node_modules;