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

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

Issue 11416004: Reject deprecated language features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: abstract class in resolver test Created 8 years, 1 month 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
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 19
20 import "mock_compiler.dart"; 20 import "mock_compiler.dart";
21 import "parser_helper.dart"; 21 import "parser_helper.dart";
22 22
23 String compile(String code, {String entry: 'main', 23 String compile(String code, {String entry: 'main',
24 String coreSource: DEFAULT_CORELIB,
24 bool enableTypeAssertions: false, 25 bool enableTypeAssertions: false,
25 bool minify: false, 26 bool minify: false,
26 bool analyzeAll: false}) { 27 bool analyzeAll: false}) {
27 MockCompiler compiler = 28 MockCompiler compiler =
28 new MockCompiler(enableTypeAssertions: enableTypeAssertions, 29 new MockCompiler(enableTypeAssertions: enableTypeAssertions,
30 coreSource: coreSource,
29 enableMinification: minify); 31 enableMinification: minify);
30 compiler.parseScript(code); 32 compiler.parseScript(code);
31 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); 33 lego.Element element = compiler.mainApp.find(buildSourceString(entry));
32 if (element == null) return null; 34 if (element == null) return null;
33 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution); 35 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution);
34 compiler.processQueue(compiler.enqueuer.resolution, element); 36 compiler.processQueue(compiler.enqueuer.resolution, element);
35 var context = new js.JavaScriptItemCompilationContext(); 37 var context = new js.JavaScriptItemCompilationContext();
36 leg.WorkItem work = new leg.WorkItem(element, null, context); 38 leg.WorkItem work = new leg.WorkItem(element, null, context);
37 work.run(compiler, compiler.enqueuer.codegen); 39 work.run(compiler, compiler.enqueuer.codegen);
38 return compiler.enqueuer.codegen.lookupCode(element); 40 return compiler.enqueuer.codegen.lookupCode(element);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 120 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
119 final spaceRe = new RegExp('\\s+'); 121 final spaceRe = new RegExp('\\s+');
120 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 122 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
121 if (shouldMatch) { 123 if (shouldMatch) {
122 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 124 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
123 } else { 125 } else {
124 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 126 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
125 } 127 }
126 } 128 }
127 129
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698