OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/cascade_2_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__cascade_2_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const cascade_2_test = Object.create(null); |
| 12 let JSArrayOfElement = () => (JSArrayOfElement = dart.constFn(_interceptors.JS
Array$(cascade_2_test.Element)))(); |
| 13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 14 cascade_2_test.main = function() { |
| 15 let a = new cascade_2_test.Element(null); |
| 16 expect$.Expect.equals(1, a.path0[dartx.length]); |
| 17 expect$.Expect.equals(a, a.path0[dartx.get](0)); |
| 18 expect$.Expect.equals(2, a.path1[dartx.length]); |
| 19 expect$.Expect.equals(a, a.path1[dartx.get](0)); |
| 20 expect$.Expect.equals(a, a.path1[dartx.get](1)); |
| 21 expect$.Expect.equals(1, a.path2[dartx.length]); |
| 22 let b = new cascade_2_test.Element(a); |
| 23 expect$.Expect.equals(2, b.path0[dartx.length]); |
| 24 expect$.Expect.equals(a, b.path0[dartx.get](0)); |
| 25 expect$.Expect.equals(b, b.path0[dartx.get](1)); |
| 26 expect$.Expect.equals(3, b.path1[dartx.length]); |
| 27 expect$.Expect.equals(a, b.path1[dartx.get](0)); |
| 28 expect$.Expect.equals(a, b.path1[dartx.get](1)); |
| 29 expect$.Expect.equals(b, b.path1[dartx.get](2)); |
| 30 expect$.Expect.equals(2, b.path2[dartx.length]); |
| 31 }; |
| 32 dart.fn(cascade_2_test.main, VoidTodynamic()); |
| 33 cascade_2_test.Element = class Element extends core.Object { |
| 34 new(parent) { |
| 35 this.parent = parent; |
| 36 } |
| 37 get path0() { |
| 38 if (this.parent == null) { |
| 39 return JSArrayOfElement().of([this]); |
| 40 } else { |
| 41 let _ = this.parent.path0; |
| 42 _[dartx.add](this); |
| 43 return _; |
| 44 } |
| 45 } |
| 46 get path1() { |
| 47 let _ = this.parent == null ? JSArrayOfElement().of([this]) : this.parent.
path1; |
| 48 _[dartx.add](this); |
| 49 return _; |
| 50 } |
| 51 get path2() { |
| 52 return this.parent == null ? JSArrayOfElement().of([this]) : (() => { |
| 53 let _ = this.parent.path2; |
| 54 _[dartx.add](this); |
| 55 return _; |
| 56 })(); |
| 57 } |
| 58 }; |
| 59 dart.setSignature(cascade_2_test.Element, { |
| 60 constructors: () => ({new: dart.definiteFunctionType(cascade_2_test.Element,
[cascade_2_test.Element])}) |
| 61 }); |
| 62 // Exports: |
| 63 exports.cascade_2_test = cascade_2_test; |
| 64 }); |
OLD | NEW |