blob: 27a4a61a5d8a7c2c1396cfba721ddfbcec3b196f [file] [log] [blame]
// Copyright (c) 2019, 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.
enum Enum {
/*strong.element: Enum.a:constant=ConstructedConstant(Enum(_name=StringConstant("Enum.a"),index=IntConstant(0)))*/
a,
/*strong.element: Enum.b:constant=ConstructedConstant(Enum(_name=StringConstant("Enum.b"),index=IntConstant(1)))*/
b,
/*strong.element: Enum.c:constant=ConstructedConstant(Enum(_name=StringConstant("Enum.c"),index=IntConstant(2)))*/
c,
}
@pragma('dart2js:noInline')
tester1() {}
@pragma('dart2js:noInline')
tester2() {}
@pragma('dart2js:noInline')
tester3() {}
class Class {
/*element: Class.state1:constant=IntConstant(1)*/
final int state1;
/*element: Class.state2:constant=ConstructedConstant(Enum(_name=StringConstant("Enum.c"),index=IntConstant(2)))*/
final Enum state2;
Class({this.state1: 1, this.state2: Enum.c});
@pragma('dart2js:noInline')
method1a() {
if (state1 == 0) {
return tester1();
} else if (state1 == 1) {
return tester2();
} else if (state1 == 2) {
return tester3();
}
}
@pragma('dart2js:noInline')
method1b() {
switch (state1) {
case 0:
return tester1();
case 1:
return tester2();
case 2:
return tester3();
}
}
@pragma('dart2js:noInline')
method2a() {
if (state2 == Enum.a) {
return tester1();
} else if (state2 == Enum.b) {
return tester2();
} else if (state2 == Enum.c) {
return tester3();
}
}
@pragma('dart2js:noInline')
method2b() {
switch (state2) {
case Enum.a:
return tester1();
case Enum.b:
return tester2();
case Enum.c:
return tester3();
}
}
}
main() {
var c = new Class();
c.method1a();
c.method1b();
c.method2a();
c.method2b();
}