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

Side by Side Diff: pkg/analyzer2dart/lib/src/dart_backend.dart

Issue 812333002: Fix analyzer2dart end2end. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer2dart.dart_backend; 5 library analyzer2dart.dart_backend;
6 6
7 import 'package:compiler/src/elements/elements.dart'; 7 import 'package:compiler/src/elements/elements.dart';
8 import 'package:compiler/src/dart_backend/dart_backend.dart'; 8 import 'package:compiler/src/dart_backend/dart_backend.dart';
9 import 'package:compiler/src/dart2jslib.dart'; 9 import 'package:compiler/src/dart2jslib.dart';
10 import 'package:compiler/src/dart_types.dart';
10 11
11 import 'driver.dart'; 12 import 'driver.dart';
12 import 'converted_world.dart'; 13 import 'converted_world.dart';
13 14
14 void compileToDart(Driver driver, ConvertedWorld convertedWorld) { 15 void compileToDart(Driver driver, ConvertedWorld convertedWorld) {
15 DartOutputter outputter = 16 DiagnosticListener listener = new Listener();
16 new DartOutputter(new Listener(), driver.outputProvider); 17 DartOutputter outputter = new DartOutputter(listener, driver.outputProvider);
18 ElementAstCreationContext context = new _ElementAstCreationContext(
19 listener, convertedWorld.dartTypes);
17 outputter.assembleProgram( 20 outputter.assembleProgram(
18 libraries: convertedWorld.libraries, 21 libraries: convertedWorld.libraries,
19 instantiatedClasses: convertedWorld.instantiatedClasses, 22 instantiatedClasses: convertedWorld.instantiatedClasses,
20 resolvedElements: convertedWorld.resolvedElements, 23 resolvedElements: convertedWorld.resolvedElements,
21 mainFunction: convertedWorld.mainFunction, 24 mainFunction: convertedWorld.mainFunction,
22 computeElementAst: (Element element) { 25 computeElementAst: (Element element) {
23 return DartBackend.createElementAst( 26 return DartBackend.createElementAst(
24 null, // No compiler. 27 context,
25 null, // No tracer.
26 DART_CONSTANT_SYSTEM,
27 element, 28 element,
28 convertedWorld.getIr(element)); 29 convertedWorld.getIr(element));
29 }, 30 },
30 shouldOutput: (_) => true, 31 shouldOutput: (_) => true,
31 isSafeToRemoveTypeDeclarations: (_) => false); 32 isSafeToRemoveTypeDeclarations: (_) => false);
33 }
32 34
35 class _ElementAstCreationContext implements ElementAstCreationContext {
36 final Listener listener;
37
38 @override
39 final DartTypes dartTypes;
40
41 _ElementAstCreationContext(this.listener, this.dartTypes);
42
43 @override
44 ConstantSystem get constantSystem => DART_CONSTANT_SYSTEM;
45
46 @override
47 InternalErrorFunction get internalError => listener.internalError;
48
49 @override
50 void traceCompilation(String name) {
51 // Do nothing.
52 }
53
54 @override
55 void traceGraph(String title, irObject) {
56 // Do nothing.
57 }
33 } 58 }
34 59
35 class Listener implements DiagnosticListener { 60 class Listener implements DiagnosticListener {
36 61
37 @override 62 @override
38 void internalError(Spannable spannable, message) { 63 void internalError(Spannable spannable, message) {
39 // TODO: implement internalError 64 throw new UnimplementedError(message);
40 } 65 }
41 66
42 @override 67 @override
43 void log(message) { 68 void log(message) {
44 // TODO: implement log 69 // TODO: implement log
45 } 70 }
46 71
47 @override 72 @override
48 void reportError(Spannable node, 73 void reportError(Spannable node,
49 MessageKind errorCode, 74 MessageKind errorCode,
(...skipping 23 matching lines...) Expand all
73 } 98 }
74 99
75 @override 100 @override
76 void reportWarning(Spannable node, 101 void reportWarning(Spannable node,
77 MessageKind errorCode, 102 MessageKind errorCode,
78 [Map arguments = const {}]) { 103 [Map arguments = const {}]) {
79 // TODO: implement reportWarning 104 // TODO: implement reportWarning
80 } 105 }
81 106
82 @override 107 @override
83 SourceSpan spanFromSpannable(Spannable node) { 108 spanFromSpannable(Spannable node) {
karlklose 2014/12/18 09:49:34 Why this change?
Johnni Winther 2014/12/18 10:05:38 SourceSpan was not imported.
84 // TODO: implement spanFromSpannable 109 // TODO: implement spanFromSpannable
85 } 110 }
86 111
87 @override 112 @override
88 withCurrentElement(element, f()) { 113 withCurrentElement(element, f()) {
89 // TODO: implement withCurrentElement 114 // TODO: implement withCurrentElement
90 } 115 }
91 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698