Files
sdk/tests/compiler/dart2js/inference/data/static_set.dart
T
Johnni Winther d29cd4f183 Add toText to SideEffects and TypeMask for testing
- and make toString more structured.

Change-Id: If62cfb8e7ee110db6dfb713236e119e7e2f0e244
Reviewed-on: https://dart-review.googlesource.com/22401
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-27 09:12:42 +00:00

79 lines
2.7 KiB
Dart

// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/*element: main:[null]*/
main() {
setTopLevelFieldUninitialized();
setStaticFieldUninitialized();
setTopLevelFieldInitialized();
setStaticFieldInitialized();
setTopLevelSetter();
setStaticSetter();
}
////////////////////////////////////////////////////////////////////////////////
/// Static set of an uninitialized top level field.
////////////////////////////////////////////////////////////////////////////////
/*element: field1:[null|exact=JSUInt31]*/
var field1;
/*element: setTopLevelFieldUninitialized:[exact=JSUInt31]*/
setTopLevelFieldUninitialized() => field1 = 42;
////////////////////////////////////////////////////////////////////////////////
/// Static set of an uninitialized static field.
////////////////////////////////////////////////////////////////////////////////
class Class1 {
/*element: Class1.field:[null|exact=JSUInt31]*/
static var field;
}
/*element: setStaticFieldUninitialized:[exact=JSUInt31]*/
setStaticFieldUninitialized() => Class1.field = 42;
////////////////////////////////////////////////////////////////////////////////
/// Static set of an initialized top level field.
////////////////////////////////////////////////////////////////////////////////
/*element: field2:Union([exact=JSString], [exact=JSUInt31])*/
dynamic field2 = '';
/*element: setTopLevelFieldInitialized:[exact=JSUInt31]*/
setTopLevelFieldInitialized() => field2 = 42;
////////////////////////////////////////////////////////////////////////////////
/// Static set of an initialized static field.
////////////////////////////////////////////////////////////////////////////////
class Class2 {
/*element: Class2.field:Union([exact=JSString], [exact=JSUInt31])*/
static dynamic field = '';
}
/*element: setStaticFieldInitialized:[exact=JSUInt31]*/
setStaticFieldInitialized() => Class2.field = 42;
////////////////////////////////////////////////////////////////////////////////
/// Static set of a top level setter.
////////////////////////////////////////////////////////////////////////////////
set _setter1(/*[exact=JSUInt31]*/ value) {}
/*element: setTopLevelSetter:[exact=JSUInt31]*/
setTopLevelSetter() => _setter1 = 42;
////////////////////////////////////////////////////////////////////////////////
/// Static get of an uninitialized static field.
////////////////////////////////////////////////////////////////////////////////
class Class3 {
static set setter(/*[exact=JSUInt31]*/ value) {}
}
/*element: setStaticSetter:[exact=JSUInt31]*/
setStaticSetter() => Class3.setter = 42;