Changes to runtime patches so Fasta can understand them.

Change-Id: I7f8d6b110f2f0c90b131a2538240c1b81bfa1578
Reviewed-on: https://dart-review.googlesource.com/17162
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Peter von der Ahé 2017-11-01 15:16:04 +00:00 committed by commit-bot@chromium.org
parent bf9dd5342f
commit 0023f99019
9 changed files with 48 additions and 10 deletions

View file

@ -0,0 +1,17 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// part of "internal_patch.dart";
class ClassID {
static int getID(Object value) native "ClassID_getID";
static final int cidArray = 0;
static final int cidExternalOneByteString = 0;
static final int cidGrowableObjectArray = 0;
static final int cidImmutableArray = 0;
static final int cidOneByteString = 0;
static final int cidTwoByteString = 0;
static final int cidBigint = 0;
}

View file

@ -272,7 +272,7 @@ class NoSuchMethodError {
return _toStringDeprecated();
}
String memberName =
internal.Symbol.getUnmangledName(_invocation.memberName);
internal.Symbol.computeUnmangledName(_invocation.memberName);
var level = (_invocation._type >> _InvocationMirror._LEVEL_SHIFT) &
_InvocationMirror._LEVEL_MASK;
var kind = _invocation._type & _InvocationMirror._KIND_MASK;
@ -311,7 +311,7 @@ class NoSuchMethodError {
if (argumentCount > 0) {
argumentsBuf.write(", ");
}
argumentsBuf.write(internal.Symbol.getUnmangledName(key));
argumentsBuf.write(internal.Symbol.computeUnmangledName(key));
argumentsBuf.write(": ");
argumentsBuf.write(Error.safeToString(value));
argumentCount++;
@ -425,7 +425,7 @@ class NoSuchMethodError {
var type = _invocation_type & _InvocationMirror._KIND_MASK;
String memberName = (_memberName == null)
? ""
: internal.Symbol.getUnmangledName(_memberName);
: internal.Symbol.computeUnmangledName(_memberName);
if (type == _InvocationMirror._LOCAL_VAR) {
return "NoSuchMethodError: Cannot assign to final variable '$memberName'";
@ -446,7 +446,7 @@ class NoSuchMethodError {
if (argumentCount > 0) {
arguments.write(", ");
}
arguments.write(internal.Symbol.getUnmangledName(key));
arguments.write(internal.Symbol.computeUnmangledName(key));
arguments.write(": ");
arguments.write(Error.safeToString(value));
argumentCount++;

View file

@ -73,7 +73,7 @@ class MirrorSystem {
@patch
static String getName(Symbol symbol) {
return internal.Symbol.getUnmangledName(symbol);
return internal.Symbol.computeUnmangledName(symbol);
}
@patch

View file

@ -10,9 +10,10 @@ class Symbol {
const Symbol(String name) : this._name = name;
@patch
toString() => 'Symbol("${getUnmangledName(this)}")';
toString() => 'Symbol("${computeUnmangledName(this)}")';
static getUnmangledName(Symbol symbol) {
@patch
static String computeUnmangledName(Symbol symbol) {
String string = Symbol.getName(symbol);
// get:foo -> foo

View file

@ -24,6 +24,11 @@ class Symbol implements core.Symbol {
@patch
toString() => 'Symbol("$_name")';
@patch
static String computeUnmangledName(Symbol symbol) {
throw "unsupported operation";
}
}
@patch

View file

@ -0,0 +1,11 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of "dart:_internal";
class _Patch {
const _Patch();
}
const _Patch patch = const _Patch();

View file

@ -137,4 +137,6 @@ class Symbol implements core.Symbol {
static bool isValidSymbol(String name) {
return (name.isEmpty || symbolPattern.hasMatch(name));
}
external static String computeUnmangledName(Symbol symbol);
}

View file

@ -109,9 +109,10 @@
"_internal": {
"patches": [
"../../runtime/lib/internal_patch.dart",
"../../runtime/lib/class_id.dart",
"../../runtime/lib/class_id_fasta.dart",
"../../runtime/lib/print_patch.dart",
"../../runtime/lib/symbol_patch.dart"
"../../runtime/lib/symbol_patch.dart",
"internal/patch.dart"
],
"uri": "internal/internal.dart"
},

View file

@ -20,9 +20,10 @@ vm:
uri: "internal/internal.dart"
patches:
- "../../runtime/lib/internal_patch.dart"
- "../../runtime/lib/class_id.dart"
- "../../runtime/lib/class_id_fasta.dart"
- "../../runtime/lib/print_patch.dart"
- "../../runtime/lib/symbol_patch.dart"
- "internal/patch.dart"
async:
uri: "async/async.dart"