77101d63e3
- Rework token position address space. - Use ClassifyingTokenPositions::kMethodExtractor for the token position of a method extractor. - Plumb token positions through all of Ast Transformer. - Plumb token positions for temporary expressions, etc in Flow Graph Builder. - Add token positions for parts of the await machinery. - Move ClassifyingTokenPositions into token.h. - Remove default token position of Scanner::kNoSourcePos for many IR instructions. - A couple of unit tests. - Use synthetic token positions for synthetic AstNodes. - Fix SLEB128 encoding / decoding + test - s/Scanner::kNoSourcePos/Token::kNoSourcePos. - Remove >= 0 and < 0 checks against token positions and use helpers instead. R=rmacnak@google.com Review URL: https://codereview.chromium.org/1589643002 .
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
// Copyright (c) 2011, 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.
|
|
|
|
#include "vm/runtime_entry.h"
|
|
|
|
#include "vm/object.h"
|
|
#include "vm/symbols.h"
|
|
#include "vm/verifier.h"
|
|
|
|
namespace dart {
|
|
|
|
|
|
// Add function to a class and that class to the class dictionary so that
|
|
// frame walking can be used.
|
|
const Function& RegisterFakeFunction(const char* name, const Code& code) {
|
|
const String& class_name = String::Handle(Symbols::New("ownerClass"));
|
|
const Script& script = Script::Handle();
|
|
const Class& owner_class =
|
|
Class::Handle(Class::New(class_name, script, Token::kNoSourcePos));
|
|
const String& function_name = String::ZoneHandle(Symbols::New(name));
|
|
const Function& function = Function::ZoneHandle(
|
|
Function::New(function_name, RawFunction::kRegularFunction,
|
|
true, false, false, false, false, owner_class, 0));
|
|
const Array& functions = Array::Handle(Array::New(1));
|
|
functions.SetAt(0, function);
|
|
owner_class.SetFunctions(functions);
|
|
Library& lib = Library::Handle(Library::CoreLibrary());
|
|
lib.AddClass(owner_class);
|
|
function.AttachCode(code);
|
|
return function;
|
|
}
|
|
|
|
} // namespace dart
|