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

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

Issue 12211013: Allow intercepted calls to have typed selectors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/types.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Test constant folding. 4 // Test constant folding.
5 5
6 library compiler_helper; 6 library compiler_helper;
7 7
8 import "dart:uri"; 8 import "dart:uri";
9 9
10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t" 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"
11 as lego; 11 as lego;
12 import "../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend .dart" 12 import "../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend .dart"
13 as js; 13 as js;
14 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart" 14 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"
15 as leg; 15 as leg;
16 import "../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart" as ssa; 16 import "../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart" as ssa;
17 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; 17 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart";
18 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; 18 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
19 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
20 show Compiler;
19 21
20 import "mock_compiler.dart"; 22 import "mock_compiler.dart";
21 import "parser_helper.dart"; 23 import "parser_helper.dart";
22 24
23 String compile(String code, {String entry: 'main', 25 String compile(String code, {String entry: 'main',
24 String coreSource: DEFAULT_CORELIB, 26 String coreSource: DEFAULT_CORELIB,
25 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, 27 String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
26 bool enableTypeAssertions: false, 28 bool enableTypeAssertions: false,
27 bool minify: false, 29 bool minify: false,
28 bool analyzeAll: false}) { 30 bool analyzeAll: false}) {
29 MockCompiler compiler = 31 MockCompiler compiler =
30 new MockCompiler(enableTypeAssertions: enableTypeAssertions, 32 new MockCompiler(enableTypeAssertions: enableTypeAssertions,
31 coreSource: coreSource, 33 coreSource: coreSource,
32 interceptorsSource: interceptorsSource, 34 interceptorsSource: interceptorsSource,
33 enableMinification: minify); 35 enableMinification: minify);
34 compiler.parseScript(code); 36 compiler.parseScript(code);
35 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); 37 lego.Element element = compiler.mainApp.find(buildSourceString(entry));
36 if (element == null) return null; 38 if (element == null) return null;
39 compiler.phase = Compiler.PHASE_RESOLVING;
37 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution); 40 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution);
38 compiler.processQueue(compiler.enqueuer.resolution, element); 41 compiler.processQueue(compiler.enqueuer.resolution, element);
39 var context = new js.JavaScriptItemCompilationContext(); 42 var context = new js.JavaScriptItemCompilationContext();
40 leg.ResolutionWorkItem resolutionWork = 43 leg.ResolutionWorkItem resolutionWork =
41 new leg.ResolutionWorkItem(element, context); 44 new leg.ResolutionWorkItem(element, context);
42 resolutionWork.run(compiler, compiler.enqueuer.resolution); 45 resolutionWork.run(compiler, compiler.enqueuer.resolution);
43 leg.CodegenWorkItem work = 46 leg.CodegenWorkItem work =
44 new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context); 47 new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context);
48 compiler.phase = Compiler.PHASE_COMPILING;
45 work.run(compiler, compiler.enqueuer.codegen); 49 work.run(compiler, compiler.enqueuer.codegen);
46 return compiler.enqueuer.codegen.assembleCode(element); 50 return compiler.enqueuer.codegen.assembleCode(element);
47 } 51 }
48 52
49 MockCompiler compilerFor(String code, Uri uri, 53 MockCompiler compilerFor(String code, Uri uri,
50 {bool analyzeAll: false, 54 {bool analyzeAll: false,
51 String coreSource: DEFAULT_CORELIB}) { 55 String coreSource: DEFAULT_CORELIB}) {
52 MockCompiler compiler = new MockCompiler( 56 MockCompiler compiler = new MockCompiler(
53 analyzeAll: analyzeAll, coreSource: coreSource); 57 analyzeAll: analyzeAll, coreSource: coreSource);
54 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code); 58 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 final xRe = new RegExp('\\bx\\b'); 133 final xRe = new RegExp('\\bx\\b');
130 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 134 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
131 final spaceRe = new RegExp('\\s+'); 135 final spaceRe = new RegExp('\\s+');
132 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 136 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
133 if (shouldMatch) { 137 if (shouldMatch) {
134 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 138 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
135 } else { 139 } else {
136 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 140 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
137 } 141 }
138 } 142 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/types.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698