Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: tests/compiler/dart2js/patch_test.dart

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:expect/expect.dart'; 6 import 'package:expect/expect.dart';
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:compiler/src/compiler.dart'; 8 import 'package:compiler/src/compiler.dart';
9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; 9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
10 import 'package:compiler/src/elements/elements.dart'; 10 import 'package:compiler/src/elements/elements.dart';
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 ensure(compiler, "method", cls.patch.lookupLocalMember, 865 ensure(compiler, "method", cls.patch.lookupLocalMember,
866 checkHasBody: true, expectIsRegular: true); 866 checkHasBody: true, expectIsRegular: true);
867 867
868 ensure(compiler, "clear", cls.lookupLocalMember, 868 ensure(compiler, "clear", cls.lookupLocalMember,
869 checkHasBody: true, expectIsPatched: true); 869 checkHasBody: true, expectIsPatched: true);
870 870
871 compiler.phase = Compiler.PHASE_DONE_RESOLVING; 871 compiler.phase = Compiler.PHASE_DONE_RESOLVING;
872 872
873 // Check that a method just in the patch class is a target for a 873 // Check that a method just in the patch class is a target for a
874 // typed selector. 874 // typed selector.
875 Selector selector = new Selector.call('method', compiler.coreLibrary, 0); 875 Selector selector = new Selector.call(const PublicName('method'), 0);
876 TypeMask typeMask = new TypeMask.exact(cls, world); 876 TypeMask typeMask = new TypeMask.exact(cls, world);
877 FunctionElement method = cls.implementation.lookupLocalMember('method'); 877 FunctionElement method = cls.implementation.lookupLocalMember('method');
878 method.computeType(compiler); 878 method.computeType(compiler);
879 Expect.isTrue(selector.applies(method, world)); 879 Expect.isTrue(selector.applies(method, world));
880 Expect.isTrue(typeMask.canHit(method, selector, world)); 880 Expect.isTrue(typeMask.canHit(method, selector, world));
881 881
882 // Check that the declaration method in the declaration class is a target 882 // Check that the declaration method in the declaration class is a target
883 // for a typed selector. 883 // for a typed selector.
884 selector = new Selector.call('clear', compiler.coreLibrary, 0); 884 selector = new Selector.call(const PublicName('clear'), 0);
885 typeMask = new TypeMask.exact(cls, world); 885 typeMask = new TypeMask.exact(cls, world);
886 method = cls.lookupLocalMember('clear'); 886 method = cls.lookupLocalMember('clear');
887 method.computeType(compiler); 887 method.computeType(compiler);
888 Expect.isTrue(selector.applies(method, world)); 888 Expect.isTrue(selector.applies(method, world));
889 Expect.isTrue(typeMask.canHit(method, selector, world)); 889 Expect.isTrue(typeMask.canHit(method, selector, world));
890 890
891 // Check that the declaration method in the declaration class is a target 891 // Check that the declaration method in the declaration class is a target
892 // for a typed selector on a subclass. 892 // for a typed selector on a subclass.
893 cls = ensure(compiler, "B", compiler.coreLibrary.find); 893 cls = ensure(compiler, "B", compiler.coreLibrary.find);
894 cls.ensureResolved(compiler); 894 cls.ensureResolved(compiler);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 testPatchNoSetter(); 1019 testPatchNoSetter();
1020 testPatchNonFunction(); 1020 testPatchNonFunction();
1021 1021
1022 testPatchAndSelector(); 1022 testPatchAndSelector();
1023 1023
1024 testEffectiveTarget(); /// bug: ok 1024 testEffectiveTarget(); /// bug: ok
1025 1025
1026 testAnalyzeAllInjectedMembers(); 1026 testAnalyzeAllInjectedMembers();
1027 testTypecheckPatchedMembers(); 1027 testTypecheckPatchedMembers();
1028 } 1028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698