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

Side by Side Diff: pkg/front_end/test/src/incremental/mock_sdk.dart

Issue 2897003003: Fix various semantic nits that Fasta will detect. (Closed)
Patch Set: Created 3 years, 7 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'package:front_end/memory_file_system.dart'; 5 import 'package:front_end/memory_file_system.dart';
6 6
7 /// Create SDK libraries which are used by Fasta to perform kernel generation. 7 /// Create SDK libraries which are used by Fasta to perform kernel generation.
8 /// Return the mapping from the simple names of these library to the URIs 8 /// Return the mapping from the simple names of these library to the URIs
9 /// in the given [fileSystem]. The root of the SDK is `file:///sdk`. 9 /// in the given [fileSystem]. The root of the SDK is `file:///sdk`.
10 Map<String, Uri> createSdkFiles(MemoryFileSystem fileSystem) { 10 Map<String, Uri> createSdkFiles(MemoryFileSystem fileSystem) {
11 Map<String, Uri> dartLibraries = {}; 11 Map<String, Uri> dartLibraries = {};
12 12
13 void addSdkLibrary(String name, String contents) { 13 void addSdkLibrary(String name, String contents) {
14 String path = '$name/$name.dart'; 14 String path = '$name/$name.dart';
15 Uri uri = Uri.parse('file:///sdk/lib/$path'); 15 Uri uri = Uri.parse('file:///sdk/lib/$path');
16 fileSystem.entityForUri(uri).writeAsStringSync(contents); 16 fileSystem.entityForUri(uri).writeAsStringSync(contents);
17 dartLibraries[name] = uri; 17 dartLibraries[name] = uri;
18 } 18 }
19 19
20 addSdkLibrary( 20 addSdkLibrary(
21 'core', 21 'core',
22 r''' 22 r'''
23 library dart.core; 23 library dart.core;
24 import 'dart:_internal'; 24 import 'dart:_internal';
25 import 'dart:async'; 25 import 'dart:async';
26 26
27 class Object { 27 class Object {
28 const Object() {} 28 const Object();
ahe 2017/05/23 14:44:27 A const constructor can't have a body.
29 bool operator ==(other) => identical(this, other); 29 bool operator ==(other) => identical(this, other);
30 String toString() => 'a string'; 30 String toString() => 'a string';
31 int get hashCode => 0; 31 int get hashCode => 0;
32 Type get runtimeType => null; 32 Type get runtimeType => null;
33 dynamic noSuchMethod(Invocation invocation) => null; 33 dynamic noSuchMethod(Invocation invocation) => null;
34 } 34 }
35 35
36 class Null {} 36 class Null {}
37 37
38 class Symbol { 38 class Symbol {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 class Symbol {} 268 class Symbol {}
269 class ExternalName { 269 class ExternalName {
270 final String name; 270 final String name;
271 const ExternalName(this.name); 271 const ExternalName(this.name);
272 } 272 }
273 '''); 273 ''');
274 addSdkLibrary('_vmservice', 'library dart._vmservice;'); 274 addSdkLibrary('_vmservice', 'library dart._vmservice;');
275 275
276 return dartLibraries; 276 return dartLibraries;
277 } 277 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/js_helper.dart » ('j') | sdk/lib/_internal/js_runtime/lib/js_helper.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698