Commit 493aa6a4 authored by Findit's avatar Findit

Revert "bind-gen: Implement CodeGenContext.idl_location_and_name"

This reverts commit 5a2bf1a6.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 714152 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzVhMmJmMWE2MjJlNzVlNDgwNmMyNWFiM2FhOTNmNzQzOGJiZTFjYTcM

Sample Failed Build: https://ci.chromium.org/b/8897108652777688192

Sample Failed Step: compile

Original change's description:
> bind-gen: Implement CodeGenContext.idl_location_and_name
> 
> Implements CodeGenContext.idl_location_and_name in order to pretty-
> print a path to an IDL file and IDL definition name being processed.
> 
> Bug: 839389
> Change-Id: I2699f735fd5897206e25364b2b29932bd0177330
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909049
> Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
> Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#714152}


Change-Id: If40954d80e71c5b10e3e7729befa99ea04ae2447
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 839389
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909715
Cr-Commit-Position: refs/heads/master@{#714155}
parent 81584280
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import copy import copy
from . import name_style from . import name_style
from .path_manager import PathManager
class CodeGenContext(object): class CodeGenContext(object):
...@@ -61,9 +60,6 @@ class CodeGenContext(object): ...@@ -61,9 +60,6 @@ class CodeGenContext(object):
"class_like", "class_like",
"function_like", "function_like",
"idl_definition", "idl_definition",
"idl_location",
"idl_location_and_name",
"idl_name",
"is_return_by_argument", "is_return_by_argument",
"may_throw_exception", "may_throw_exception",
"member_like", "member_like",
...@@ -158,31 +154,6 @@ class CodeGenContext(object): ...@@ -158,31 +154,6 @@ class CodeGenContext(object):
or self.dictionary or self.enumeration or self.interface or self.dictionary or self.enumeration or self.interface
or self.namespace or self.typedef or self.union) or self.namespace or self.typedef or self.union)
@property
def idl_location(self):
idl_def = self.member_like or self.idl_definition
if idl_def:
location = idl_def.debug_info.location
text = PathManager.relpath_to_project_root(location.filepath)
if location.line_number is not None:
text += ":{}".format(location.line_number)
return text
return "<<unknown path>>"
@property
def idl_location_and_name(self):
return "{}: {}".format(self.idl_location, self.idl_name)
@property
def idl_name(self):
member = self.member_like or self.property_
if member:
return "{}.{}".format(self.class_like.identifier,
member.identifier)
if self.idl_definition:
return self.idl_definition.identifier
return "<<unknown name>>"
@property @property
def is_return_by_argument(self): def is_return_by_argument(self):
if self.return_type is None: if self.return_type is None:
......
...@@ -38,14 +38,6 @@ class PathManager(object): ...@@ -38,14 +38,6 @@ class PathManager(object):
"third_party", "blink", "renderer", "") "third_party", "blink", "renderer", "")
cls._is_initialized = True cls._is_initialized = True
@classmethod
def relpath_to_project_root(cls, path):
index = path.find(cls._blink_path_prefix)
if index < 0:
assert path.startswith(cls._blink_path_prefix[1:])
return path
return path[index + 1:]
def __init__(self, idl_definition): def __init__(self, idl_definition):
assert self._is_initialized, self._REQUIRE_INIT_MESSAGE assert self._is_initialized, self._REQUIRE_INIT_MESSAGE
...@@ -90,7 +82,7 @@ class PathManager(object): ...@@ -90,7 +82,7 @@ class PathManager(object):
Returns a path to a Blink implementation file relative to the project Returns a path to a Blink implementation file relative to the project
root directory, e.g. "third_party/blink/renderer/..." root directory, e.g. "third_party/blink/renderer/..."
""" """
return self.relpath_to_project_root( return self._rel_to_root(
self._join( self._join(
dirpath=self._blink_dir, dirpath=self._blink_dir,
filename=(filename or self._blink_basename), filename=(filename or self._blink_basename),
...@@ -128,8 +120,14 @@ class PathManager(object): ...@@ -128,8 +120,14 @@ class PathManager(object):
filename=(filename or self._out_basename), filename=(filename or self._out_basename),
ext=ext) ext=ext)
@staticmethod def _rel_to_root(self, path):
def _join(dirpath, filename, ext=None): index = path.find(self._blink_path_prefix)
if index < 0:
assert path.startswith(self._blink_path_prefix[1:])
return path
return path[index + 1:]
def _join(self, dirpath, filename, ext=None):
if ext is not None: if ext is not None:
filename = os.path.extsep.join([filename, ext]) filename = os.path.extsep.join([filename, ext])
return os.path.join(dirpath, filename) return os.path.join(dirpath, filename)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment